echarts-仪表盘

文章详细描述了如何使用ECharts库创建一个具有渐变颜色、特定尺寸和指针的自定义仪表盘,展示了数据值43的进度条配置。
摘要由CSDN通过智能技术生成

const options = {
        series: [
          {
            radius: "95%", // 仪表盘的大小,可以是像素值或者百分比
            type: "gauge",
            progress: {
              show: true,
              width: 8,
              itemStyle: {
                color: {
                  type: "linear",
                  x: 1,
                  y: 0,
                  x2: 0,
                  y2: 1,
                  colorStops: [
                    {
                      offset: 0,
                      color: "rgba(70, 111, 245, 1)", // 0% 处的颜色
                    },
                    {
                      offset: 1,
                      color: "rgba(79, 224, 232, 1)", // 100% 处的颜色
                    },
                  ],
                  global: false, // 缺省为 false
                },
              },
            },
            axisLine: {
              lineStyle: {
                width: 8,
                color: [[1, "rgba(7, 44, 111, 1)"]],
              },
            },
            axisTick: {
              show: true, //是否显示刻度
              distance: 2,
              itemStyle: {
                color: "#fff",
                width: 2,
              },
            },
            splitLine: {
              distance: 2,
              length: 5,
              lineStyle: {
                width: 2,
                color: "#fff",
              },
            },
            axisLabel: {
              distance: 10,
              color: "#fff",
              fontSize: 12,
            },
            // 表盘指针中间的固定点
            anchor: {
              show: true,
              showAbove: true,
              size: 12,
              itemStyle: {
                color: "#4572F3",
                borderColor: "#F7F9FD;",
                borderWidth: 2,
              },
            },
            // 指针
            pointer: {
              width: 6,
              length: "80%",
              offsetCenter: [0, "-10%"], //指针位置 默认圆中心
              itemStyle: {
                color: '#C9D6FF'
              },
            },
            title: {
              show: false,
            },
            detail: {
              fontSize: 0,
            },
            data: [
              {
                value: 43,
              },
            ],
            splitNumber: 5,
          },
        ],
      };

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值