echarts 一条柱状图显示两个值,类似进度条

var allUseDayChartTwo;
function allUseDayChartTwoFun(obj,xdata,ydata,zdata){
	allUseDayChartTwo = echarts.init(obj);
	var category = xdata;
	var lineData = zdata;
	var barData = ydata;
	option = {
//		backgroundColor:'#F00',
	    tooltip: {
	        trigger: 'axis',
	        backgroundColor:'rgba(0,0,0,.5)',
	        axisPointer: {
	            type: 'shadow',
	            label: {
	                show: true,
	                backgroundColor: '#F1F1F1',
	                color:'#5A5A5A'
	            }
	        },
	        confine: true
	    },
	    grid: {
            left: '1%',
           	right: '3%',
          	bottom: '5%',
        	top: '5%',
        	containLabel: true
        },
	    xAxis: {
	        axisLine: {
	            lineStyle: {
	                color: '#B4B4B4'
	            }
	        },
	        axisTick:{
	            show:false,
	        },
	        axisLine:{
                show:false
            },
            axisTick:{
                show:false
            },
            splitLine:{
                show:false
            },
			axisLabel:{
	        	textStyle: {
                    fontSize: 14,
                },
	            formatter:'{value} ',
	        },

	    },
	    yAxis: [{
			data: category,
	        splitLine: {show: false},
	        axisLine: {
	            lineStyle: {
	                color: '#B4B4B4',
	            }
	        },
	        axisLabel:{
	        	textStyle: {
                    fontSize: 14,
//                  color: '#B2B2B2'
                },
	            formatter:'{value} ',
	        },
	        axisLine:{
                show:false
            },
            axisTick:{
                show:false
            },
            splitLine:{
                show:false
            }
	    }
//	    ,{
//			data: category,
//	        splitLine: {show: false},
//	        axisLine: {
//	            lineStyle: {
//	                color: '#B4B4B4',
//	            }
//	        },
//	        axisLabel:{
//	            formatter:'{value} ',
//	        }
//	    }
	    ],
	    series: [{
	        name: '用量',
	        type: 'bar',
	        barWidth: 15,
	        barGap: '-100%',
	        itemStyle: {
	            normal: {
	                barBorderRadius: 5,
	                color: new echarts.graphic.LinearGradient(
	                    0, 0, 0, 1,
	                    [
	                        {offset: 0, color: 'rgba(88,228,88,0.8)'},
	                        {offset: 1, color: 'rgba(88,228,88,0.8)'}
	                    ]
	                )
	            }
	        },
	        data: barData
	    },{
	        name: '阈值',
	        type: 'bar',
	        barGap: '-100%',
	        barWidth: 15,
	        itemStyle: {
	            normal: {
	                barBorderRadius: 5,
	                color: new echarts.graphic.LinearGradient(
	                    0, 0, 0, 1,
	                    [
	                        {offset: 0, color: 'rgba(234,234,234,0.8)'},
	                        {offset: 0.2, color: 'rgba(234,234,234,1)'},
	                        {offset: 1, color: 'rgba(234,234,234,1)'}
	                    ]
	                )
	            }
	        },
	        z: -12,
	        data: lineData
	    }
//	    ,{
//	        name: '背景',
//	        type: 'bar',
//	        barGap: '-100%',
//	        barWidth: 15,
//	        itemStyle: {
//	            normal: {
//	                barBorderRadius: 5,
//	                color: new echarts.graphic.LinearGradient(
//	                    0, 0, 0, 1,
//	                    [
//	                        {offset: 0, color: 'rgba(0,0,0,0.2)'},
//	                        {offset: 0.2, color: 'rgba(0,0,0,0.)'},
//	                        {offset: 1, color: 'rgba(0,0,0,0.24)'}
//	                    ]
//	                )
//	            }
//	        },
//	        z: -20,
//	        data: [50,50,50,50,50,50,50,50,50]
//	    }
	    ]
	};
	allUseDayChartTwo.setOption(option);
}

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值