Pie Chart Case 1

Renderings:
insert image description here

option = {
    
    
  title: {
    
    
    text: '大于100公里',
    left: 'center',
    bottom: '0'
  },
  tooltip: {
    
    
    trigger: "item",
    confine: true, // 是否将 tooltip 框限制在图表的区域内
    formatter: function (params) {
    
    
      return (
        params.seriesName + "<br/>" + params.name + ": " + params.value
      );
    },
  },
  series: [
    {
    
    
      name: "设备数量",
      type: "pie",
      radius: ["60%", "75%"],
      avoidLabelOverlap: false,
      label: {
    
    
        show: true,
        position: "center",
        formatter: "346台",
        fontSize: 18,
        color: '#000',
        fontWeight: 'bold'
      },
      labelLine: {
    
    
        show: false,
      },

      data: [
        {
    
    
          value: 1048,
          name: "总数",
          itemStyle: {
    
    
            color: "#eee",
          },
        },
        {
    
    
          value: 735,
          name: "大于100公里",
          itemStyle: {
    
    
            color: "#00c36e",
          },
        },
      ],
    },
  ],
};

Guess you like

Origin blog.csdn.net/IT_dabai/article/details/130738897