Echarts饼状图

 let myChart = echarts.init(document.getElementById("charts"));
      let option = {
        title: {
          text: "99999",
          textStyle: {
            color: "#000",
            fontSize: 30,
            fontWeight: "bold",
          },
          subtext: "设备总量",
          subtextStyle: { //副标题的属性
            color: "#000",
            fontSize: 13,
          },
          x: "center",
          y: "115",
        },
 
        series: [
          {
            // name: "",
            type: "pie",
            radius: ["40%", "50%"],
            labelLine: {
              //设置提示线的长度
              normal: {
                length: 15,
              },
            },

 

            data: [
              {
                value: 2509,
                name: "设备1",
                itemStyle: {
                  color: "rgba(252, 113, 77, 1)",
                },
              },
              {
                value: 1000,
                name: "设备2",
                itemStyle: {
                  color: "rgba(39, 162, 255, 1)",
                },
              },
              {
                value: 1000,
                name: "设备3",
                itemStyle: {
                  color: "rgba(93, 222, 180, 1)",
                },
              },
              {
                value: 1000,
                name: "设备4",
                itemStyle: {
                  color: "rgba(225, 105, 204, 1)",
                },
              },
            ],
          },
        ],
      };

 

      myChart.setOption(option);
      window.addEventListener("resize", function () {
        myChart.resize();
      });

 

posted @ 2021-12-03 15:49  码渣渣123  阅读(157)  评论(0)    收藏  举报