feat(echarts-pie): add string template support for labels (#28774)

This commit is contained in:
Hex Café
2024-06-13 00:18:45 +08:00
committed by GitHub
parent cc492ffed4
commit a067ffb92d
4 changed files with 179 additions and 0 deletions

View File

@@ -123,11 +123,31 @@ const config: ControlPanelConfig = {
['key_percent', t('Category and Percentage')],
['key_value_percent', t('Category, Value and Percentage')],
['value_percent', t('Value and Percentage')],
['template', t('Template')],
],
description: t('What should be shown on the label?'),
},
},
],
[
{
name: 'label_template',
config: {
type: 'TextControl',
label: t('Label Template'),
renderTrigger: true,
description: t(
'Format data labels. ' +
'Use variables: {name}, {value}, {percent}. ' +
'\\n represents a new line. ' +
'ECharts compatibility:\n' +
'{a} (series), {b} (name), {c} (value), {d} (percentage)',
),
visibility: ({ controls }: ControlPanelsContainerProps) =>
controls?.label_type?.value === 'template',
},
},
],
[
{
name: 'number_format',