中间的有效率 :
- 可以使用title属性,放在中间
- 可以使用定位position定位到圆的中间
参数:
pieOption = {
title: {
text: '我',
top: '36%',
left: '46%',
subtext: '有效率',
textAlign: 'center', // 对齐方式
textStyle: { // 主标题样式
color: '#82929F', // 8595A1
fontWeight: 'normal',
fontSize: 28,
lineHeight: 28,
// align:'center',
},
subtextStyle: { // 子标题样式
color: '#8595A1',
fontSize: 14,
lineHeight: 14,
align: 'right',
// textAlign:'right',
}
},
legend: {},
tooltip:{},
series: [
{
name: '有效率',
type: 'pie',
radius: ['70%', '100%'], // 圆的半径
hoverAnimation: false, // 取消hover的动作
hoverOffset: 0, // 高亮扇区的偏移距离,0的时候,就没有偏移了。
avoidLabelOverLap: true, // 是否启用防止标签重叠策略,默认开启,
label: { // 饼图图形上的文本标签,可用于说明图形的一些数据信息,比如值,名称等,
normal: {
show: false, // 默认没有hover时,汉字是否显示
position: 'center', // 每一项汉字的位置:'outside','inside','center'
},
emphasis: { // hover后,汉字的显隐和样式(高亮的扇区和标签样式)
show: false,
textStyle: {
fontSize: '16',
fontWeight: 'bold'
}
}
},
labelLine: { // 标签的视觉引导线样式
normal: { // 可以有normal,也可以不加
show: true,
length: 100, // 视觉引导线第一段的长度。
length2: 30, // 视觉引导项第二段的长度。
smooth: 0.1, // 是否平滑视觉引导线,默认不平滑,可以设置成 true 平滑显示,也可以设置为 0 到 1 的值,表示平滑程度。
lineStyle: {
width: 3, // 引导线的w
type: 'dashed', // 'solid','dashed','dotted'
}
}
},
data: [
{
value: 10,
name: '使用',
itemStyle: {
color: '#329AF0',
},
emphasis: {
itemStyle: {
// color: 'red',
}
}
},
{
value: 30,
name: '无效',
itemStyle: {
color: '#ccc',// 颜色
},
emphasis: {
itemStyle: {
color: '#dcdcdc', // hover后的颜色
}
}
}
]
}
]
}