echarts仪表盘和圆形结合

效果图
在这里插入图片描述
注意: 使用startAngle: 200,endAngle: -20,在数据为零时,会出现一个实心圆,需要调整一下角度。
效果
在这里插入图片描述

代码

var option = {
      series: [
        {
          type: "gauge",
          center: ["50%", "50%"],
          radius: "80%",
          startAngle: 190,
          endAngle: -10,
          // minAngle:10,
          min: 0,
          max: 100,
          z: 5,
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
                {
                  offset: 0,
                  color: "#65e1fb",
                },
                {
                  offset: 1,
                  color: "#2e70f6",
                },
              ]),
            },
            shadowBlur: 10,
            shadowOffsetX: 2,
            shadowOffsetY: 2
          },
          progress: {
            show: true,
            roundCap: true,
            width: 5
          },
          pointer: {
            show: false
          },
          axisLine: {
            show: false,
            lineStyle: {
              width: 30
            }
          },
          axisTick: {
            show: false,
          },
          splitLine: {
            show: false,
          },
          axisLabel: {
            show: false,
          },
          anchor: {
            show: false
          },
          title: {
            show: false
          },
          detail: {
            valueAnimation: true,
            width: "60%",
            lineHeight: 40,
            borderRadius: 8,
            offsetCenter: [0, "-5%"],
            fontSize: "14px",
            ffontFamily: "Impact",
            formatter: "{value} %",
            color: "#fff",
          },
          data: data
        },
      ]
    };

效果图
在这里插入图片描述
主要使用:echarts中的仪表盘、和三个圆进行实现
代码

var option = {
      series: [
        {
          type: "gauge",
          center: ["50%", "50%"],
          radius: "95%",
          startAngle: 200,
          endAngle: -20,
          min: 0,
          max: 100,
          z: 5,
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
                {
                  offset: 0,
                  color: "#65e1fb",
                },
                {
                  offset: 1,
                  color: "#2e70f6",
                },
              ]),
            },
          },
          progress: {
            show: true,
            roundCap: true,
            width: 5
          },
          pointer: {
            show: false
          },
          axisLine: {
            show: false,
            lineStyle: {
              width: 30
            }
          },
          axisTick: {
            show: false,
          },
          splitLine: {
            show: false,
          },
          axisLabel: {
            show: false,
          },
          anchor: {
            show: false
          },
          title: {
            show: false
          },
          detail: {
            valueAnimation: true,
            width: "60%",
            lineHeight: 40,
            borderRadius: 8,
            offsetCenter: [0, "2%"],
            fontSize: 12,
            // fontWeight: "bolder",
            formatter: "{value} %",
            color: "#fff",
          },
          data: [
            {
              value: this.props.data || 100
            }
          ]
        },
        {
          name: "数量",
          type: "pie",
          hoverAnimation: false,
          clockwise: false,
          radius: ["70%", "70%"],
          center: ["50%", "50%"],
          data: [10],
          itemStyle: {
            normal: {
              borderWidth: 1,
              borderType: "dotted",//dotted 虚线
              borderColor: "#78d7ff",// 虚线颜色
              opacity: 0.5,
            },
          },
          label: {
            normal: {
              show: false,
            },
            emphasis: {
              show: false,
              textStyle: {
                fontSize: "14",
              },
            },
          },
          labelLine: {
            normal: {
              show: false,
            },
          },
        },
        {
          name: "数量",
          type: "pie",
          hoverAnimation: false,
          clockwise: false,
          radius: ["65%", "65%"],
          center: ["50%", "50%"],
          data: [10],
          itemStyle: {
            normal: {
              borderWidth: 1,
              borderType: "dotted",//dotted 虚线
              borderColor: "#78d7ff",// 虚线颜色
              opacity: 0.5,
            },
          },
          label: {
            normal: {
              show: false,
            },
            emphasis: {
              show: false,
              textStyle: {
                fontSize: "14",
              },
            },
          },
          labelLine: {
            normal: {
              show: false,
            },
          },
        },
        {
          name: "数量",
          type: "pie",
          hoverAnimation: false,
          clockwise: false,
          radius: "55%",
          center: ["50%", "50%"],
          data: [10],
          itemStyle: {
            normal: {
              color: "#53bcf9",
            },
          },
          label: {
            normal: {
              show: false,
            },
            emphasis: {
              show: false,
              textStyle: {
                fontSize: "14",
              },
            },
          },
          labelLine: {
            normal: {
              show: false,
            },
          },
        }
      ]
    };
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值