You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by li...@apache.org on 2024/03/13 21:32:07 UTC

(superset) branch big-number-percentage-format created (now 4899e0481d)

This is an automated email from the ASF dual-hosted git repository.

lilykuang pushed a change to branch big-number-percentage-format
in repository https://gitbox.apache.org/repos/asf/superset.git


      at 4899e0481d fix(big-number-chart): number format is not applying to percentage number of the time comparison

This branch includes the following new commits:

     new 4899e0481d fix(big-number-chart): number format is not applying to percentage number of the time comparison

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(superset) 01/01: fix(big-number-chart): number format is not applying to percentage number of the time comparison

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lilykuang pushed a commit to branch big-number-percentage-format
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 4899e0481dc3583f9ec1f3f47f33793c5e9a3ac5
Author: lilykuang <ji...@gmail.com>
AuthorDate: Wed Mar 13 13:38:26 2024 -0700

    fix(big-number-chart): number format is not applying to percentage number of the time comparison
---
 .../src/BigNumber/BigNumberPeriodOverPeriod/controlPanel.ts      | 9 +++++++++
 .../src/BigNumber/BigNumberPeriodOverPeriod/transformProps.ts    | 5 ++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/controlPanel.ts b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/controlPanel.ts
index be731421a0..6aa54e72d2 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/controlPanel.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/controlPanel.ts
@@ -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'],
         [
           {
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/transformProps.ts
index ebdd16bdb1..05d188e882 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/transformProps.ts
@@ -84,6 +84,7 @@ export default function transformProps(chartProps: ChartProps) {
     currencyFormat,
     subheaderFontSize,
     comparisonColorEnabled,
+    percentDifferenceFormat,
   } = formData;
   const { data: dataA = [] } = queriesData[0];
   const {
@@ -113,9 +114,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;