Echarts 使用小拓展饼图pie
echarts官网链接: https://www.echartsjs.com/zh/option.html#series-pie.type.
echarts使用小记录
代码片段:(vue中使用,其他使用中,道理一样的)
1.单独设饼图颜色,设置渐变
2.label样式
this.chart = echarts.init(this.$refs.lineEcharts);
this.chart.setOption({
tooltip: {
trigger: 'item',
formatter: '{b}: {d}%'
},
//饼图中渐变,单独设置饼图颜色
color: ['#2a95ff', {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0, color: '#fea764'// 0% 处的颜色
}, {
offset: 1, color: '#eb489f' // 100% 处的颜色
}]
}],
legend: {
show: false
},
series: [
{
name: '访问来源',
type: 'pie',
radius: ['20%', '30%'],//设置为空心的
selectedOffset: 2, // 选中的饼块后偏离位置.即显示的缝隙的大小
width: 238,
height: 238,
labelLine: {
normal: {