echarts icon indicating copy to clipboard operation
echarts copied to clipboard

饼图圆心与title中心 为什么不是一个坐标

Open dog952777 opened this issue 8 years ago • 3 comments

{
        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 不在 图表的中心 这个两个 % 不是一个参照物

dog952777 avatar Dec 04 '18 04:12 dog952777

http://echarts.baidu.com/option.html#title.textStyle.align 试试设置 title.textStyle.align 和 verticalAlign 为 'middle'

pissang avatar Dec 04 '18 09:12 pissang

遇到了同样的问题,怎么没解决就关闭了

Coodool avatar Dec 27 '18 15:12 Coodool

遇到了同样的问题,怎么没解决就关闭了

饼图中间放文字很麻烦,用graphic要处理resize()重新定位,用series.label层叠又太多,楼主用title的思路估计也不好走。

y4n6 avatar Dec 27 '18 16:12 y4n6