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

johnbodley pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 3a7d76cece feat: Add ValuePercent option to LABEL TYPE for Pie and 
Funnel charts (#26407)
3a7d76cece is described below

commit 3a7d76cece4408c8e80862ab9db3a38eaaafdc8c
Author: 周小馬 <[email protected]>
AuthorDate: Fri Jan 5 05:00:27 2024 +0800

    feat: Add ValuePercent option to LABEL TYPE for Pie and Funnel charts 
(#26407)
---
 .../plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx          | 4 ++++
 .../plugins/plugin-chart-echarts/src/Funnel/transformProps.ts         | 2 ++
 superset-frontend/plugins/plugin-chart-echarts/src/Funnel/types.ts    | 1 +
 .../plugins/plugin-chart-echarts/src/Pie/controlPanel.tsx             | 1 +
 .../plugins/plugin-chart-echarts/src/Pie/transformProps.ts            | 2 ++
 superset-frontend/plugins/plugin-chart-echarts/src/Pie/types.ts       | 1 +
 6 files changed, 11 insertions(+)

diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx 
b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx
index 76c1465357..3908ea4516 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx
@@ -124,6 +124,10 @@ const config: ControlPanelConfig = {
                   EchartsFunnelLabelTypeType.KeyValuePercent,
                   t('Category, Value and Percentage'),
                 ],
+                [
+                  EchartsFunnelLabelTypeType.ValuePercent,
+                  t('Value and Percentage'),
+                ],
               ],
               description: t('What should be shown as the label'),
             },
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/transformProps.ts 
b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/transformProps.ts
index a8d8c9e65c..df43fe0a83 100644
--- 
a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/transformProps.ts
+++ 
b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/transformProps.ts
@@ -94,6 +94,8 @@ export function formatFunnelLabel({
       return `${name}: ${formattedValue} (${formattedPercent})`;
     case EchartsFunnelLabelTypeType.KeyPercent:
       return `${name}: ${formattedPercent}`;
+    case EchartsFunnelLabelTypeType.ValuePercent:
+      return `${formattedValue} (${formattedPercent})`;
     default:
       return name;
   }
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/types.ts 
b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/types.ts
index 928664e223..5159562234 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/types.ts
@@ -52,6 +52,7 @@ export enum EchartsFunnelLabelTypeType {
   KeyValue,
   KeyPercent,
   KeyValuePercent,
+  ValuePercent,
 }
 
 export interface EchartsFunnelChartProps
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Pie/controlPanel.tsx 
b/superset-frontend/plugins/plugin-chart-echarts/src/Pie/controlPanel.tsx
index 53d406538d..8a7612c20f 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Pie/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Pie/controlPanel.tsx
@@ -107,6 +107,7 @@ const config: ControlPanelConfig = {
                 ['key_value', t('Category and Value')],
                 ['key_percent', t('Category and Percentage')],
                 ['key_value_percent', t('Category, Value and Percentage')],
+                ['value_percent', t('Value and Percentage')],
               ],
               description: t('What should be shown on the label?'),
             },
diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts 
b/superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts
index 4ad92b0bb2..031b072b44 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts
@@ -80,6 +80,8 @@ export function formatPieLabel({
       return `${name}: ${formattedValue} (${formattedPercent})`;
     case EchartsPieLabelType.KeyPercent:
       return `${name}: ${formattedPercent}`;
+    case EchartsPieLabelType.ValuePercent:
+      return `${formattedValue} (${formattedPercent})`;
     default:
       return name;
   }
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Pie/types.ts 
b/superset-frontend/plugins/plugin-chart-echarts/src/Pie/types.ts
index d4acbb9517..631c1c7de3 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Pie/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Pie/types.ts
@@ -54,6 +54,7 @@ export enum EchartsPieLabelType {
   KeyValue = 'key_value',
   KeyPercent = 'key_percent',
   KeyValuePercent = 'key_value_percent',
+  ValuePercent = 'value_percent',
 }
 
 export interface EchartsPieChartProps

Reply via email to