mirror of
https://github.com/apache/superset.git
synced 2026-04-17 15:15:20 +00:00
feat: Add ValuePercent option to LABEL TYPE for Pie and Funnel charts (#26407)
This commit is contained in:
@@ -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'),
|
||||
},
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ export enum EchartsFunnelLabelTypeType {
|
||||
KeyValue,
|
||||
KeyPercent,
|
||||
KeyValuePercent,
|
||||
ValuePercent,
|
||||
}
|
||||
|
||||
export interface EchartsFunnelChartProps
|
||||
|
||||
@@ -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?'),
|
||||
},
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ export enum EchartsPieLabelType {
|
||||
KeyValue = 'key_value',
|
||||
KeyPercent = 'key_percent',
|
||||
KeyValuePercent = 'key_value_percent',
|
||||
ValuePercent = 'value_percent',
|
||||
}
|
||||
|
||||
export interface EchartsPieChartProps
|
||||
|
||||
Reference in New Issue
Block a user