feat: Add ValuePercent option to LABEL TYPE for Pie and Funnel charts (#26407)

This commit is contained in:
周小馬 2024-01-05 05:00:27 +08:00 committed by GitHub
parent dfde2adf27
commit 3a7d76cece
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 0 deletions

View File

@ -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'),
},

View File

@ -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;
}

View File

@ -52,6 +52,7 @@ export enum EchartsFunnelLabelTypeType {
KeyValue,
KeyPercent,
KeyValuePercent,
ValuePercent,
}
export interface EchartsFunnelChartProps

View File

@ -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?'),
},

View File

@ -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;
}

View File

@ -54,6 +54,7 @@ export enum EchartsPieLabelType {
KeyValue = 'key_value',
KeyPercent = 'key_percent',
KeyValuePercent = 'key_value_percent',
ValuePercent = 'value_percent',
}
export interface EchartsPieChartProps