仪表盘

描述:当前是关于Echarts图表中的 仪表盘 示例。
 
            // 仪表盘外围的数字
const standard = ['D', 'C', 'B', 'A', ]
// 拥挤度对假数据区分
const arr = [0,  25, 50, 75,  100]
option = {
    backgroundColor: '#072B79',
    series: [
        {
            name: '刻度',
            type: 'gauge',
            radius: '78%',
            z: 500,
            min: 0,
            max: 100,
            center: ['50%', '60%'],
            splitNumber: 4, //刻度数量
            startAngle: 180,
            endAngle: 0,           
              pointer: {//仪表盘指针
                        show: true,
                        width:  20,
                        length: 30,
                         icon:'triangle',
                        offsetCenter: [0, '-70%'],
                        itemStyle:{
                            color:'auto'
                        }
                    },
            axisLine: {
                show: true,
                   distance: 10,
                lineStyle: {
                    width: 10,
                    color: [
                        [1 / 4,'#ff0004'],
                        [1 / 2,'#f8ff01'],
                        [3 / 4, '#00d6f6'],
                        [1,'#00f846'],
                    ],
                },
            }, //仪表盘轴线
            axisLabel: {
                show: false,
            }, //刻度标签。
            axisTick: {
                splitNumber: 10,
                distance: 13,
                show: true,
                lineStyle: {
                    color: 'auto',
                    width: 1,
                },
                length: 10,
            }, //刻度样式
            splitLine: {
                show: true,
                   distance:10,
                lineStyle: {
                    color: 'auto',
                    width:4,
                },
                  length: 20,
            }, //分隔线样式
                title: {
                        color: '#fff',
                        offsetCenter: [0, '-35%'],
                        fontSize: 27
                      },  
            detail: {
                        formatter: function (value) {
                            var num = Math.round(value);
                            return '{bule|' + num + '}{bule|分}';
                        },
                        rich: {
                            bule: {
                                fontSize:30,
                                fontFamily: 'siyuan',
                                color:'auto',
                                fontWeight: '500',
                            },
                        },
                        offsetCenter: ['0%', '-10%'],
                    },
                    data:[{
                         
                name:'等级评定',
                value:40,
            
                    }]
        },
        {
            name: '描述',
            type: 'gauge',
            radius: '77%',
            center: ['50%', '60%'],
            splitNumber: 3, //刻度数量
            startAngle: 165,
            endAngle: 15,
            z: 0,
            axisLine: {
                show: false,
            },
        axisLabel: {
        show: true,
        distance: -50,
        formatter: (val) => {
          val = Number(val)
          for (let i = 0; i < arr.length; i++) {
            if (val > arr[i] && val <= arr[i + 1]) {
              return standard[i]
            }
            if (val === arr[0]) {
              return standard[0]
            }
          }
        },
        color: '#ffffff',
        fontSize: 30
      },
            axisTick: {
                show: false,

            }, //刻度样式
            splitLine: {
                show: false,
                length: 0,
                lineStyle: {
                    color: 'auto',
                    width: 0,
                },
            }, //分隔线样式
            detail: {
                show: false,
            },

        },
    ],
};