echarts-gauge-bar

let option = {
        grid: {
          show: false,
          containLabel: true,
        },
        angleAxis: {
          show: false,
          max: 200, //-45度到225度,二者偏移值是270度除360度
          type: "value",
          startAngle: 180, //极坐标初始角度
          splitLine: {
            show: false,
          },
        },
        barMaxWidth: 7, //圆环宽度
        radiusAxis: {
          show: false,
          type: "category",
        },
        //圆环位置和大小
        polar: {
          center: ["50%", "50%"],
          radius: "180%",
        },
        series: [
          {
            type: "bar",
            data: [
              {
                //上层圆环,显示数据
                value: 50,
                itemStyle: {
                  color: data.isBig ? 'red' : "green",
                },
              },
            ],
            coordinateSystem: "polar",
            roundCap: true, //顶端圆角
            z: 2, //圆环层级,同zindex
          },
          {
            //下层圆环,显示最大值
            type: "bar",
            data: [
              {
                value: 100,
                itemStyle: {
                  color: data.isBig ? 'green' : "red",
                },
              },
            ],
            barGap: "-100%",
            coordinateSystem: "polar",
            roundCap: true,
            z: 1,
          },
          {
            type: "gauge",
            startAngle: 180, //起始角度,同极坐标
            endAngle: 0, //终止角度,同极坐标
            radius: "100%",
            splitNumber: 2,
            max: 1,
            center: ["50%", "57%"],
            axisLine: {
              show: false,
            },
            splitLine: {
              show: false,
              length: 5,
              distance: 1,
              lineStyle: {
                color: "#eee",
              },
            },
            axisTick: {
              show: false,
            },
            axisLabel: {
              show: true,
              color: "#ffffff",
              fontSize: 6,
            },
            pointer: {
              show: true,
              length: "50%",
              width: 3,
              offsetCenter: [0, 0],
            },
            itemStyle: {
              color: "#CCCCCC",
            },
            detail: {
              color: "rgba(4, 228, 199, 1)",
              fontSize: 14,
              offsetCenter: [0, 18],
              borderRadius: 8,
            },
            data: [
              {
                value: data.value,
              },
            ],
          },
        ],
      };

在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值