Skip to content

Commit

Permalink
fix(big-number-chart): number format is not applying to percentage nu…
Browse files Browse the repository at this point in the history
…mber of the time comparison (apache#27502)

(cherry picked from commit d2c9001)
  • Loading branch information
Lily Kuang authored and sadpandajoe committed Apr 1, 2024
1 parent 7b663bf commit 5f968cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
ChartProps,
getMetricLabel,
getValueFormatter,
NumberFormats,
getNumberFormatter,
formatTimeRange,
} from '@superset-ui/core';
Expand Down Expand Up @@ -84,6 +83,7 @@ export default function transformProps(chartProps: ChartProps) {
currencyFormat,
subheaderFontSize,
comparisonColorEnabled,
percentDifferenceFormat,
} = formData;
const { data: dataA = [] } = queriesData[0];
const {
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 5f968cb

Please sign in to comment.