饼图

描述:当前是关于Echarts图表中的 饼图 示例。
 
            
// endregion

const data = [
        { name: "实际", value: 7890, isActive: true },
        { name: "计划", value: 23412, isActive: false },

      ]
const colorList = [
    new echarts.graphic.LinearGradient(0, 0, 1, 0, [
      {
        offset: 0,
        color: "rgba(84, 217, 255,0)",
      },
      {
        offset: 1,
        color: "rgba(84, 217, 255,1)",
      },
    ]),
    new echarts.graphic.LinearGradient(1, 0, 0, 0, [
      {
        offset: 0,
        color: "rgba(84, 255, 111,0)",
      },
      {
        offset: 1,
        color: "rgba(84, 255, 111,1)",
      },
    ])
  ];
const color = [
    "rgba(84, 217, 255,1)",
    "rgba(84, 255, 111,1)",

  ];


option = {
   backgroundColor:'#000',

    series: [
      {
        name: "mainPie",
        type: "pie",
        radius: [160, 200],
        center: ["50%", "50%"], // 图形位置
        itemStyle: {
          color: (params) => {
      
              return colorList[params.dataIndex];
          
          },
        },
        label: {
          show: true,
          position: "center",
          formatter: (params) => {
            return `{title|2023年\n发电情况}`;
          },
          rich: {
            title: {
              padding: 5,
              align: "center",
              verticalAlign: "middle",
              fontSize: 24,
              fontFamily: 'Microsoft YaHei',
              fontWeight: 500,
              color: "rgba(211, 232, 255, 1)",
            },
       
          },
        },
        emphasis: {
          show: true,
          scaleSize: 10,
          itemStyle: {},
          label: {
            show: true,
          },
        },
        data: data,
      },
    
    ],
};