Echarts 之横向柱状图(完成度用汉字标识)

效果图

代码 

<script src="../js/echarts-4.1.0/echarts.js"></script>
<script src="../js/theme/customed.js"></script>
<script type="text/javascript">
    var yAxisData = ['项目1','项目2','项目3','项目4','项目5'];
    var zdxmData = [95,30,10,50,100];
    var valdata = [100,100,100,100,100];
    var option = {
        xAxis: {
            show: false
        },
        grid: {
            top:'2%',
            left: '2%',
            right: '2%',
            bottom: '2%',
            containLabel: true
        },
        yAxis: [{
            show: true,
            data: valdata,
            inverse: true,
            axisLine: {
                show: false
            },
            splitLine: {
                show: false
            },
            axisTick: {
                show: false
            },
            axisLabel: {
                formatter: function(value, index) {
                    return [
                        (index + 1)
                    ].join('\n')
                },
                rich: {
                    lg: {
                        // backgroundColor: '#339911',
                        // color: '#fff',
                        borderRadius: 15,
                        // padding: 5,
                        align: 'center',
                        width: 15,
                        height: 15
                    },
                }
            },
    
    
        }, {
            show: true,
            inverse: true,
            data: yAxisData,
            axisLine: {
                show: false
            },
            splitLine: {
                show: false
            },
            axisTick: {
                show: false
            },
    
        }],
        series: [{
            name: '条',
            type: 'bar',
            yAxisIndex: 0,
            data: zdxmData,
            barWidth: 15,
            itemStyle: {
                normal: {
                    barBorderRadius: 30,
                    color: '#1089E7'
                }
            },
            label: {
                normal: {
                    show: true,
                    position: 'insideRight',
                    fontSize:'10',
                    formatter: function(params) {
                        if(params.value == 95){
                            return "待验收";
                        }else if(params.value == 30 || params.value == 50){
                            return "建设中";
                        }else if(params.value == 10){
                            return "已立项";
                        }else if(params.value == 100){
                            return "已完成";
                        }
                    }
                }
            },
        }, {
            name: '框',
            type: 'bar',
            yAxisIndex: 1,
            barGap: '-100%',
            data: [100, 100, 100, 100, 100],
            barWidth: 15,
            itemStyle: {
                normal: {
                    color: 'none',
                    borderColor: '#00c1de',
                    borderWidth: 3,
                    barBorderRadius: 15,
                }
            }
        }, ]
    };
</script>

 工作中使用到的,总结归纳后,仅供各位大神们参考......

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值