仪表盘组合一

新东西:markPoint、渐变色

效果图:
在这里插入图片描述
代码:

const colors = ["#8CE0A6","#23CBF1","#D5B32F", '#F87B8C'];
option = {
  series: [
    { // 外层
      type: 'gauge',
      startAngle: -90,
      endAngle: 270,
      radius: '68%',
      axisLine: {
        lineStyle: {
          width: 10,    // 外围光圈宽度
          color:  [   // 圆形颜色渐变
            [0.1, colors[0]],
            [0.3, new echarts.graphic.LinearGradient(
              0, 1, 0, 0,
              [{
                  offset: 0,
                  color: colors[0]
                }, {
                  offset: 0.8,
                  color: colors[1]
              }]
            )],
            [0.4, colors[1]],
            [0.6, new echarts.graphic.LinearGradient(
              0, 0, 1, 0,
              [{
                offset: 0,
                color: colors[1]
              }, {
                offset: 0.9,
                color: colors[2]
              }]
            )],
            [0.9, new echarts.graphic.LinearGradient(
              0, 1, 0, 0,
              [{
                offset: 0,
                color: colors[3]
              }, {
                offset: 0.6,
                color: colors[2]
              }]
            )],
            [1, colors[3]]
          ],
        }
      },
      pointer: {
        show: false,
      },
      axisTick: {
        show: false,
      },
      splitNumber: 4,   // 东南西北四个方向的须须
      splitLine: {
        show: true,
        distance: -28,
        length: 17,
        lineStyle: {
          color: "auto",
          width: 3
        }
      },
      axisLabel: {
        show: false,
      },
      detail: {
        show: false,
      },
      data: [
        {
          value: 100
        }
      ]
    },
    {  // 内层
      type: 'gauge',
      startAngle: -90,
      endAngle: 270,
      radius: '60%',
      splitNumber: 18,
      axisLine: {
        lineStyle: {
          width: 50,   // 内层分格断宽度
          color:  [
            [0.1, colors[0]],
            [0.3, new echarts.graphic.LinearGradient(
              0, 1, 0, 0,
              [{
                offset: 0,
                color: colors[0]
              }, {
                offset: 0.8,
                color: colors[1]
              }]
            )],
            [0.4, colors[1]],
            [0.6, new echarts.graphic.LinearGradient(
              0, 0, 1, 0,
              [{
                offset: 0,
                color: colors[1]
              }, {
                offset: 0.9,
                color: colors[2]
              }]
            )],
            [0.9, new echarts.graphic.LinearGradient(
              0, 1, 0, 0,
              [{
                offset: 0,
                color: colors[3]
              }, {
                offset: 0.6,
                color: colors[2]
              }]
            )],
            [1, colors[3]]
          ],
        }
      },
      markPoint:{    // 指针中间的固定点
        symbol:'circle',
        symbolSize:25,
        data:[
          //跟你的仪表盘的中心位置对应上 颜色 auto自适应
          {x:'center',y:'center',itemStyle:{color: 'auto'}}
        ]
      },
      pointer: {
        itemStyle: {
          color: 'auto' // 颜色 auto自适应
        }
      },
      axisTick: {
        show: false,
      },
      splitLine: {
        distance: -50,   // 跟axisLine的宽度保持一致
        length: 50,
        lineStyle: {
          color: '#fff',  // 改成背景颜色
          width: 10
        }
      },
      axisLabel: {
        show: false,
      },
      detail: {
        show: false,
      },
      data: [
        {
          value: 67
        }
      ]
    }
  ]
};

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值