vue环进度图、双环进度图 - echart图表

如图所示:

在这里插入图片描述

代码如下:(复制另存txt,修改.html直接运行)
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>环进度图、双环进度图 - echart图表</title>
  <!-- 引入样式 -->
  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
  <style>
    #app{
        display: flex;
        justify-content: center;
    }
    .testChart{
      width: 100px;
      height: 100px;
      background: #fff;
      padding: 20px;
    }
  </style>
</head>
<body style="background: #eee;">
  <div id="app">
    <div ref="testOne" class="testChart"></div>
    <div ref="testTwo" class="testChart"></div>
  </div>
</body>

<script src="https://lib.baomitu.com/vue/2.6.14/vue.js"></script>
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<!-- 引入 echart -->
<script src="https://lib.baomitu.com/echarts/5.2.0/echarts.min.js"></script>

<script>
  new Vue({
    el: '#app',
    data() {
      return { 
        myTestOneChart:{},
        myTestTwoChart:{},
      }
    },
    mounted(){
        this.testOneChart()
        this.testTwoChart()
        window.onresize = ()=>{ //窗口变化自动重载
            this.myTestOneChart.resize()
            this.myTestTwoChart.resize()
        }
    },
    methods: {
        testOneChart(){
            this.myTestOneChart = echarts.init(this.$refs.testOne);
            let option = {
                series: [{
                    type: 'gauge',
                    radius: '100%',
                    startAngle: 90,
                    endAngle: -270,
                    pointer: {
                        show: false
                    },
                    progress: {
                        show: true,
                        overlap: false,
                        roundCap: true,
                        clip: true,
                        itemStyle: {
                            // borderWidth: 10,
                            // borderColor: ['#FFC16B','#0050E7']
                        }
                    },
                    axisLine: {
                        lineStyle: {
                            width: 6,
                            borderColor: '#04BEFB'
                        }
                    },
                    splitLine: {
                        show: false,
                        distance: 0,
                        length: 10
                    },
                    axisTick: {
                        show: false
                    },
                    axisLabel: {
                        show: false,
                        distance: 5
                    },
                    color:"#00D7B5",
                    data: [
                        {
                            value: 80,
                            name: '下单门店数\n占比',
                            title: {
                                offsetCenter: ['1%', '40%'],
                            },
                            detail: {
                                offsetCenter: ['4%', '-10%']
                            }
                        },
                    ],
                    title: {
                        fontSize: 10,
                        color: '#A5A5A5',
                    },
                    detail: {
                        width: 15,
                        height: 6,
                        fontSize: 16,
                        color: 'auto',
                        borderColor: 'auto',
                        fontFamily: "FinFont-Bold, FinFont",
                        // borderRadius: 20,
                        // borderWidth: 8,
                        formatter: '{value}%'
                    }
                }]
            }

            // 使用刚指定的配置项和数据显示图表。
            this.myTestOneChart.setOption(option);
        },
        testTwoChart(){
            this.myTestTwoChart = echarts.init(this.$refs.testTwo);
            let option = {
                series: [{
                    type: 'gauge',
                    radius: '100%',
                    startAngle: 90,
                    endAngle: -270,
                    pointer: {
                        show: false
                    },
                    progress: {
                        show: true,
                        overlap: false,
                        roundCap: true,
                        clip: true,
                        itemStyle: {
                            // borderWidth: 10,
                            // borderColor: ['#FFC16B','#0050E7']
                        }
                    },
                    axisLine: {
                        lineStyle: {
                            width: 8,
                            borderColor: '#04BEFB'
                        }
                    },
                    splitLine: {
                        show: false,
                        distance: 0,
                        length: 10
                    },
                    axisTick: {
                        show: false
                    },
                    axisLabel: {
                        show: false,
                        distance: 5
                    },
                    color:["#19AEF7","#00D7B5"],
                    data: [
                        {
                            value: 30,
                            name: '时间进度',
                            title: {
                                offsetCenter: ['1%', '-15%']
                            },
                            detail: {
                                offsetCenter: ['4%', '-45%']
                            },
                            itemStyle: {
                                fontSize: 13,
                            }
                        },
                        {
                            value: 50,
                            name: '月完成率',
                            title: {
                                offsetCenter: ['1%', '60%'],
                            },
                            detail: {
                                offsetCenter: ['4%', '30%']
                            }
                        },
                    ],
                    title: {
                        fontSize: 10,
                        color: '#A5A5A5',
                    },
                    detail: {
                        width: 15,
                        height: 6,
                        fontSize: 16,
                        color: 'auto',
                        borderColor: 'auto',
                        fontFamily: "FinFont-Bold, FinFont",
                        // borderRadius: 20,
                        // borderWidth: 8,
                        formatter: '{value}%'
                    }
                }]
            }

            // 使用刚指定的配置项和数据显示图表。
            this.myTestTwoChart.setOption(option);
        },
    }
  })
</script>
</html>

备注:

来隔壁部门支援,我的天呐,他们真的是996,震惊!!!

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

刘斩仙的笔记本

富贵险中求

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值