feat: pie chart add label

This commit is contained in:
ulleo
2025-06-24 14:26:26 +08:00
parent ab2cd1d594
commit 97ded1a315
@@ -24,6 +24,10 @@ export class Pie extends BaseG2Chart {
.encode('y', y[0].value)
.encode('color', series[0].value)
.legend('color', { position: 'bottom', layout: { justifyContent: 'center' } })
.label({
position: 'outside',
text: (data: any) => `${data[series[0].value]}: ${data[y[0].value]}`,
})
.tooltip((data) => {
return { name: y[0].name, value: data[y[0].value] }
})