Skip to content

Commit 97ded1a

Browse files
committed
feat: pie chart add label
1 parent ab2cd1d commit 97ded1a

File tree

1 file changed

+4
-0
lines changed
  • frontend/src/views/chat/component/charts

1 file changed

+4
-0
lines changed

frontend/src/views/chat/component/charts/Pie.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ export class Pie extends BaseG2Chart {
2424
.encode('y', y[0].value)
2525
.encode('color', series[0].value)
2626
.legend('color', { position: 'bottom', layout: { justifyContent: 'center' } })
27+
.label({
28+
position: 'outside',
29+
text: (data: any) => `${data[series[0].value]}: ${data[y[0].value]}`,
30+
})
2731
.tooltip((data) => {
2832
return { name: y[0].name, value: data[y[0].value] }
2933
})

0 commit comments

Comments
 (0)