This commit is contained in:
BianLzhaoMin 2025-12-01 09:45:31 +08:00
parent a085d983fd
commit 3200945615
2 changed files with 20 additions and 9 deletions

View File

@ -80,22 +80,33 @@ export default {
: (dataItem.value / total) * 100
).toFixed(1)
// rich.a width: 30 4
//
const maxNameLength = 4
const displayName =
name.length > maxNameLength
? name.slice(0, maxNameLength) + '..'
: name
if (data.showAfter) {
return `{a|${name}} {b|${percent}%} {c|(${dataItem.value})}`
return `{a|${displayName}} {b|${percent}%} {c|(${dataItem.value})}`
} else {
// return `{a|${dataItem.value}} {b|${name}} {c|${percent}%}`
return `{a|${name}} {b|${dataItem.value}} {c|${percent}%}`
return `{a|${displayName}} {b|${dataItem.value}} {c|${percent}%}`
}
},
textStyle: {
fontSize: 6,
rich: {
a: {
width: 30,
align: 'center',
// formatter 使
// ECharts rich formatter
width: 50,
align: 'center', //
overflow: 'hidden', //
},
b: {
width: 40,
width: 30,
align: 'center',
// padding: [0, 10, 0, 0],
color: '#666',
@ -112,8 +123,8 @@ export default {
{
name: '数据分布',
type: 'pie',
radius: ['25%', '38%'],
center: ['22%', '50%'], //
radius: ['30%', '45%'],
center: ['25%', '50%'], //
avoidLabelOverlap: false,
label: {
show: true, //

View File

@ -102,7 +102,7 @@ export default {
orient: 'vertical',
right: '5%',
top: 'center',
itemGap: 24,
itemGap: 10,
itemWidth: 10,
itemHeight: 10,
selectedMode: false, // legend
@ -129,7 +129,7 @@ export default {
align: 'right',
},
b: {
width: 40,
width: 50,
padding: [0, 10, 0, 0],
color: '#666',
},