• echars 饼图使用


    option = {
          tooltip: {
            trigger: 'item',
            formatter: '{a} <br/>{b}: {c} ({d}%)'
          },
          legend: {
            orient: 'vertical',
            x: 'right',
            y: 'center',
            align: 'left',//文字永远在左侧
            icon: 'circle',// 这个字段控制形状 类型包括 circle,rect ,roundRect,triangle,diamond,pin,arrow,none
            data: [
              {
                name: '红码人数',
                textStyle: {
                  fontSize: 12,
                  color: 'white'
                }
              },
              {
                name: '黄码人数',
                textStyle: {
                  fontSize: 12,
                  color: 'white'
                }
              },
              {
                name: '绿码人数',
                textStyle: {
                  fontSize: 12,
                  color: 'white'
                }
              }
            ],
            formatter(name) {   //文字显示图形数据
              var index = 0;
              var clientlabels = ['红码人数','黄码人数','绿码人数'];
              var clientcounts = [`${data.red}`,`${data.yellow}`,`${data.green}`];
              clientlabels.forEach((value,i) => {
                if (value === name){
                  index = i;
                }
              });
              return `${name}  ${clientcounts[index]}`;
            }
          },
          color: ['red', 'yellow', 'green'],
          series: [
            {
              name: '',
              type: 'pie',
              radius: ['35%', '45%'],
              center: ['35%', '50%'],
              avoidLabelOverlap: false,
              label: {
                normal: {
                  show: true,
                  position: 'center',
                  formatter(argument) {
                    var html;
                    html = `${data.number} 总人数`;
                    return html;
                  },
                  textStyle: {
                    fontSize: 15,
                    color: '#fff'
                  }
                }
              },
              labelLine: {
                show: false
              },
              data: [
                { value: `${data.red}`, name: '红码人数' },
                { value: `${data.yellow}`, name: '黄码人数' },
                { value: `${data.green}`, name: '绿码人数' }
              ]
            }
          ]
        };
    点关注各类It学习资源免费送+V 1153553800
  • 相关阅读:
    Tkinter之Label部件
    Tkinter编码风格
    GUI之tkinter视窗设计模块
    绘制函数图像
    backbone学习总结(一)
    实习两个月,写在辞职的今天
    Spark SQL 编程初级实践2- 编程实现利用 DataFrame 读写 MySQL 的数据
    Spark SQL 编程初级实践1-Spark SQL 基本操作
    spark创建DataFrame的几种方式
    python-with open() as file相关参数以及常用打开方式
  • 原文地址:https://www.cnblogs.com/binary1010/p/13539457.html
Copyright © 2020-2023  润新知