diff --git a/frontend/src/views/chat/component/charts/Pie.ts b/frontend/src/views/chat/component/charts/Pie.ts index 433b1f05..baaf707c 100644 --- a/frontend/src/views/chat/component/charts/Pie.ts +++ b/frontend/src/views/chat/component/charts/Pie.ts @@ -30,16 +30,24 @@ export class Pie extends BaseG2Chart { y: y[0].value, color: series[0].value, }, + scale: { + x: { + nice: true, + }, + y: { + type: 'linear', + }, + }, legend: { color: { position: 'bottom', layout: { justifyContent: 'center' } }, }, + animate: { enter: { type: 'waveIn' } }, labels: [ { - position: 'outside', + position: 'spider', text: (data: any) => { return `${data[series[0].value]}: ${data[y[0].value]}${_data.isPercent ? '%' : ''}` }, - transform: [{ type: 'exceedAdjust' }, { type: 'overlapHide' }], }, ], tooltip: { diff --git a/g2-ssr/charts/pie.js b/g2-ssr/charts/pie.js index eb52534b..3495b476 100644 --- a/g2-ssr/charts/pie.js +++ b/g2-ssr/charts/pie.js @@ -21,18 +21,22 @@ function getPieOptions(baseOptions, axis, data) { y: y[0].value, color: series[0].value, }, + scale: { + x: { + nice: true, + }, + y: { + type: 'linear', + }, + }, legend: { color: {position: 'bottom', layout: {justifyContent: 'center'}}, }, labels: [ { - position: 'outside', + position: 'spider', text: (data) => `${data[series[0].value]}: ${data[y[0].value]}${_data.isPercent ? '%' : ''}`, - transform: [ - { type: 'exceedAdjust' }, - { type: 'overlapHide' }, - ], }, ], tooltip: {