echarts 进度条

在这里插入图片描述

var colors = ["#f00","#00f","#ff0","#0ff","#f0f"];
option = {
    title: {
        text: '世界人口总量',
        subtext: '数据来自网络'
    },
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: {
        show:false, //不显示x轴相关信息
    },
    yAxis: [
        {
            type: 'category',
            data: ['html5', 'css', 'js', 'vue', 'node'],
            axisTick:{show:false}, //不显示刻度线
            axisLabel:{
                color:"#000"
            },
            axisTick:{
                show:false
            },
            axisLine:{
                show:false
            },
            inverse:true
            
        },
        {
            type: 'category',
            data: [702, 350, 666, 555, 777],
            axisTick:{show:false}, //不显示刻度线
            axisLabel:{
                color:"#000"
            },
            axisTick:{
                show:false
            },
             axisLine:{
                show:false
            },
            inverse:true
        },
        
    ],
    series: [
        {
            name: '条',
            yAxisIndex:0,
            type: 'bar',
            data: [70, 33, 60, 78, 69],
            // 修改第一条柱子的圆角
            itemStyle:{
                normal:{
                    barBorderRadius:20,
                    color:function(params){
                        //params 传递过来的柱子对象
                        // dataIndex 是当前柱子的索引
                        var num = colors.length;
                        return colors[params.dataIndex%num]
                    }
                },
                // color 可以修改柱子的颜色
                // color:"orange"
            },
            // 柱子之间的间距
            barCategoryGap:5,
            // 柱子之间的宽度
            barWidth:20,
            // 显示柱子内的文字
            label:{
                show:true,
                position:"inside",
                formatter:"{c}%"    
                // {c} 会自动解析为data中的数据
            }
        },
        {
            name: '框',
             yAxisIndex:1,
            type: 'bar',
            data: [100, 100, 100, 100, 100],
            // 柱子之间的间距
            barCategoryGap:5,
             // 柱子之间的宽度
            barWidth:20,
            itemStyle:{
                color:"none", //填充色
                borderColor:"#00f",
                borderWidth:2,
                barBorderRadius:15
            }
        }
    ]
};
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值