配置项如下
option = {
backgroundColor: '#000',
tooltip: {
trigger: 'item',
formatter: "{b} <br/>{a} : {c} 个<br/>占比: {d}%"
},
legend: {
left: 0,
top: 30,
itemGap: 20,
textStyle: {
fontSize: 32,
color: '#fff'
},
orient: 'vertical',
data: ['市级', '禅城区', '南海区', '顺德区', '三水区', '高明区']
},
calculable: true,
series: [{
name: '数据表',
type: 'pie',
center: ['50%', '50%'],
roseType: 'radius',
label: {
normal: {
show: false
},
emphasis: {
show: false
}
},
lableLine: {
normal: {
show: false
},
emphasis: {
show: false
}
},
data: [{
value: 137,
name: '市级',
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
offset: 0,
color: '#6862ff'
}, {
offset: 0.7,
color: '#d3beff'
}, {
offset: 1,
color: '#fff'
}], false)
}
}
}, {
value: 98,
name: '禅城区',
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#00b4ff'
}, {
offset: 0.5,
color: '#a6f3ff'
}, {
offset: 1,
color: '#fff'
}], false)
}
}
}, {
value: 109,
name: '南海区',
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#ffc600'
}, {
offset: 0.8,
color: '#fff0bd'
}, {
offset: 1,
color: '#fff'
}], false)
}
}
}, {
value: 112,
name: '顺德区',
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(1, 0.3, 0, 0.3, [{
offset: 0,
color: '#0072ff'
}, {
offset: 0.8,
color: '#a6ceff'
}, {
offset: 1,
color: '#fff'
}], false)
}
}
}, {
value: 97,
name: '三水区',
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(1, 1, 0, 0, [{
offset: 0,
color: '#00fff6'
}, {
offset: 0.7,
color: '#b9fffd'
}, {
offset: 1,
color: '#fff'
}], false)
}
}
}, {
value: 80,
name: '高明区',
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(1, 1, 0, 0, [{
offset: 0,
color: '#ff8d00'
}, {
offset: 0.6,
color: '#ffddb2'
}, {
offset: 1,
color: '#fff'
}], false)
}
}
}]
}
]
};