0
点赞
收藏
分享

微信扫一扫

echarts中的饼图图例文字和tooltip显示不全

技术只适用于干活 2021-09-30 阅读 159
Vue脚手架

option = {
        tooltip: {
          trigger: 'item',
          formatter: '{b} : {c} ({d}%)',
          confine: true,
          extraCssText:
            'white-space: normal; word-break: break-all;z-index:100000;'
        } /* 设置提示 */,
        legend: {
          type: 'scroll',
          orient: 'vertical',
          x: '70%',
          y: '15%',
          data: JSON.parse(JSON.stringify(this.legendData)),
          formatter: function(name) {
            if (!name) return '';
            if (name.length > 25) {
              name = name.slice(0, 25) + '...';
            }
            return name
          }
        } /* 设置参数的位置,数据 */,
        series: [
          {
            name: '访问来源',
            type: 'pie',
            radius: '45%',
            center: ['40%', '50%'],
            animation: false,
            data: JSON.parse(JSON.stringify(this.seriesData)),
            itemStyle: {
              emphasis: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      };

举报

相关推荐

0 条评论