diff --git a/plugins/legacy-preset-chart-big-number/src/BigNumber/BigNumber.tsx b/plugins/legacy-preset-chart-big-number/src/BigNumber/BigNumber.tsx index eff8f5a8ea..266026b73d 100644 --- a/plugins/legacy-preset-chart-big-number/src/BigNumber/BigNumber.tsx +++ b/plugins/legacy-preset-chart-big-number/src/BigNumber/BigNumber.tsx @@ -76,7 +76,7 @@ type BigNumberVisProps = { height: number; bigNumber?: number | null; bigNumberFallback?: TimeSeriesDatum; - formatNumber: NumberFormatter; + headerFormatter: NumberFormatter | TimeFormatter; formatTime: TimeFormatter; fromDatetime?: number; toDatetime?: number; @@ -98,7 +98,7 @@ class BigNumberVis extends React.PureComponent { static defaultProps = { className: '', - formatNumber: defaultNumberFormatter, + headerFormatter: defaultNumberFormatter, formatTime: smartDateVerboseFormatter, headerFontSize: PROPORTION.HEADER, kickerFontSize: PROPORTION.KICKER, @@ -173,8 +173,8 @@ class BigNumberVis extends React.PureComponent { } renderHeader(maxHeight: number) { - const { bigNumber, formatNumber, width } = this.props; - const text = bigNumber === null ? t('No data') : formatNumber(bigNumber); + const { bigNumber, headerFormatter, width } = this.props; + const text = bigNumber === null ? t('No data') : headerFormatter(bigNumber); const container = this.createTemporaryContainer(); document.body.append(container); @@ -246,7 +246,7 @@ class BigNumberVis extends React.PureComponent { mainColor, subheader, startYAxisAtZero, - formatNumber, + headerFormatter, formatTime, fromDatetime, timeRangeFixed, @@ -283,7 +283,8 @@ class BigNumberVis extends React.PureComponent { { }, }; const transformed = transformProps(propsWithDatasource); - expect(transformed.formatNumber(transformed.bigNumber)).toStrictEqual('1.23'); + expect(transformed.headerFormatter(transformed.bigNumber)).toStrictEqual('1.23'); }); }); });