Echarts legend翻页滚动形式

有时legend过多,需要翻页或者滚动形式,可以设置orient: "vertical",   type: 'scroll',这两个属性,完整代码如下:

var myChart = echarts.init($("#lindi_lindiArea")[0]);
  var option = {
    tooltip: {
      trigger: "item",
      formatter: "{a} <br/>{b} : {c} ({d}%)",
    },

    legend: {
      orient: "vertical",
      type: 'scroll',
      x: "left",
      y: "-25",
      bottom:"10%",
      itemGap :2,
      itemWidth:15,
      itemHeight:7,
      data: type,
      textStyle: {
        color: "#e9ebee",
        fontSize:9,
      },
    },
    series: [
      {
        label: {
          show: false,
          position: "center",
        },
        name: "",
        type: "pie",
        radius: "80%",
        center: ["70%", "50%"],
        data: typeData,
      },
    ],
  };
  myChart.setOption(option);

效果图:

猜你喜欢

转载自blog.csdn.net/chenguizhenaza/article/details/112938719
今日推荐