Skip to content

Commit

Permalink
feat: Add ValuePercent option to LABEL TYPE for Pie and Funnel charts (
Browse files Browse the repository at this point in the history
  • Loading branch information
kainchow committed Jan 4, 2024
1 parent dfde2ad commit 3a7d76c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export enum EchartsFunnelLabelTypeType {
KeyValue,
KeyPercent,
KeyValuePercent,
ValuePercent,
}

export interface EchartsFunnelChartProps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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?'),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export enum EchartsPieLabelType {
KeyValue = 'key_value',
KeyPercent = 'key_percent',
KeyValuePercent = 'key_value_percent',
ValuePercent = 'value_percent',
}

export interface EchartsPieChartProps
Expand Down

0 comments on commit 3a7d76c

Please sign in to comment.