fix: TypeScript error in PriceChart Tooltip formatter

This commit is contained in:
MarkLo 2025-12-20 08:00:14 +08:00
parent c4fc8904eb
commit 95b456faf7
1 changed files with 8 additions and 2 deletions

View File

@ -154,7 +154,10 @@ export function PriceChart({ priceData, priceStats, ticker }: PriceChartProps) {
tickFormatter={(value) => `$${value.toFixed(0)}`}
/>
<Tooltip
formatter={(value: number) => [`$${formatNumber(value)}`, '收盤價']}
formatter={(value: number | undefined) => [
value !== undefined ? `$${formatNumber(value)}` : '-',
'收盤價'
]}
labelFormatter={(label) => `日期: ${label}`}
/>
<Line
@ -242,7 +245,10 @@ export function PriceChart({ priceData, priceStats, ticker }: PriceChartProps) {
}}
/>
<Tooltip
formatter={(value: number) => [value.toLocaleString(), '交易量']}
formatter={(value: number | undefined) => [
value !== undefined ? value.toLocaleString() : '-',
'交易量'
]}
labelFormatter={(label) => `日期: ${label}`}
/>
<Bar dataKey="Volume" fill="#93c5fd" name="交易量" />