echarts 环状图的各部位名称

option = {
//标题
title: {
text: [‘已开展前期’,‘146个’].join(’\n’), //主标题
subtext: ‘传感器’,//副标题
top:‘center’,//距离顶部的位置
left: ‘center’,//距离左侧的位置
textStyle: {
// 主标题样式
color: ‘rgba(255,255,255,1)’,
fontWeight: ‘bold’,
fontSize: 12,
},
},
//鼠标悬停的数据提示
tooltip: {
trigger: ‘item’//按数据
},
//图例
legend: {
orient: ‘vertical’,
type: ‘scroll’,
top: ‘5%’,
left: ‘center’
},
series: [
{
name: ‘Access From’,
type: ‘pie’,
radius: [‘40%’, ‘70%’],
avoidLabelOverlap: false,// 避免lable重叠
hoverAnimation: false,//关闭环状弹弹弹
label: {
show: false,
position: ‘center’
},
emphasis: {
label: {
show: true,
fontSize: ‘40’,
fontWeight: ‘bold’
}
},
labelLine: {
show: false
},
data: [
{ value: 1048, name: ‘Search Engine’ },
{ value: 735, name: ‘Direct’ },
{ value: 580, name: ‘Email’ },
{ value: 484, name: ‘Union Ads’ },
{ value: 300, name: ‘Video Ads’ }
],
/自定义样式
itemStyle: {
normal: {
//这里是重点 颜色
color: function (params) {
//注意,如果颜色太少的话,后面颜色不会自动循环,最好多定义几个颜色
var colorList = [’#143D66’,’#3274FC’ ]
return colorList[params.dataIndex]
},
},
},
}
]
};

你可能感兴趣的:(echarts,echarts,前端,javascript)