fix(big-number-chart): number format is not applying to percentage number of the time comparison (#27502)

This commit is contained in:
Lily Kuang 2024-03-14 13:48:34 -07:00 committed by GitHub
parent 6b529a4b68
commit d2c90013fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 4 deletions

View File

@ -118,6 +118,15 @@ const config: ControlPanelConfig = {
expanded: true,
controlSetRows: [
['y_axis_format'],
[
{
name: 'percentDifferenceFormat',
config: {
...sharedControls.y_axis_format,
label: t('Percent Difference format'),
},
},
],
['currency_format'],
[
{

View File

@ -21,7 +21,6 @@ import {
ChartProps,
getMetricLabel,
getValueFormatter,
NumberFormats,
getNumberFormatter,
formatTimeRange,
} from '@superset-ui/core';
@ -84,6 +83,7 @@ export default function transformProps(chartProps: ChartProps) {
currencyFormat,
subheaderFontSize,
comparisonColorEnabled,
percentDifferenceFormat,
} = formData;
const { data: dataA = [] } = queriesData[0];
const {
@ -113,9 +113,7 @@ export default function transformProps(chartProps: ChartProps) {
w: 'Week' as string,
};
const formatPercentChange = getNumberFormatter(
NumberFormats.PERCENT_SIGNED_1_POINT,
);
const formatPercentChange = getNumberFormatter(percentDifferenceFormat);
let valueDifference: number | string = bigNumber - prevNumber;