echarts
echarts copied to clipboard
饼图圆心与title中心 为什么不是一个坐标
{
title: {
text: measureName,
padding: [24, 0],
textStyle: {
fontSize: 18,
align: 'center',
color: weColor[0]
},
left: '30%',
top: '40%'
},
tooltip: {
trigger: 'item',
formatter: "{b}: {c} ({d}%)"
},
legend: {
name: '',
itemGap: 15,
itemHeight: 17,
top: '20%',
left: '60%',
textStyle: {
color: '#409EFF'
},
data: parse.xData
},
color: weColor,
series: [{
label: {
normal: {
show: false,
fontSize: 14,
formatter: '{b} \n{c} ({d}%)'
}
},
type: 'pie',
center: ['30%', '40%'],
radius: ['34%', '50%'],
data: dataArr,
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 2, 2, 0.3)'
}
}
}]
}
图表center设置 30% 40%
图表title 的left:30% top:40%
为什么title 不在 图表的中心 这个两个 % 不是一个参照物
http://echarts.baidu.com/option.html#title.textStyle.align 试试设置 title.textStyle.align 和 verticalAlign 为 'middle'
遇到了同样的问题,怎么没解决就关闭了
遇到了同样的问题,怎么没解决就关闭了
饼图中间放文字很麻烦,用graphic要处理resize()重新定位,用series.label层叠又太多,楼主用title的思路估计也不好走。