fix: fix pie chart display showing incorrect visual proportions

This commit is contained in:
ulleo
2025-12-11 18:12:09 +08:00
committed by ulleo
parent 6f71807e25
commit 348fa1443f
2 changed files with 19 additions and 7 deletions
@@ -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: {
+9 -5
View File
@@ -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: {