echars重叠柱状图

echars叠加柱状图的使用

 var myChart1 = this.$echarts.init(document.getElementById('powerBar'));
		  let option1 = {
			title : {
				subtext : '执行次数',
				subtextStyle : {
					'color' : '#6E6E6E',
					'fontStyle' : 'normal',
					'fontWeight' : 'lighter',
					'fontSize' : 14,
					'verticalAlign' : 'middle',
				},
				left : '10%',
			},//标题属性
			tooltip : {
				trigger: 'axis',
				axisPointer : {            // 坐标轴指示器,坐标轴触发有效
					type : 'shadow'        // 默认为直线,可选为:'line' | 'shadow'
				}
			},
			legend: {
				data: ['成功次数', '失败次数'],
				left: '60%',//距离左侧的百分比
			},
			grid: {
				left: '10%',
				right: '10%',
				bottom: '3%',
				containLabel: true
			},
			xAxis: {
				name : '操作类型',//x轴说明
				type: 'category',
				data: this.typesData,
			},
			yAxis:  {
				type: 'value',
				splitLine:{
					show:true,
					lineStyle:{
						color:'#DCDCDC',
						width: 1,
						type: 'dotted',//虚线

					},
				},
				splitNumber: 10,//y轴分割段数
			},
			series: [
				{
					name: '成功次数',
					type: 'bar',
					stack: '次数',
					barWidth : 20,
					itemStyle:{
						normal: {
							//柱形图圆角,初始化效果
							color:'#d48265',
							//barBorderRadius:[0, 10, 10, 0],
							label: {
								show: true,//是否展示
								textStyle: {
									fontWeight:'bolder',
									fontSize : '12',
									fontFamily : '微软雅黑',
								}
							}
						},
					},
					label: {
						normal: {
							show: true,
							position: 'insideRight'
						}
					},
					data: this.successData
				},
				{
					name: '失败次数',
					type: 'bar',
					stack: '次数',
					barWidth : 20,
					itemStyle:{
						normal: {
							//柱形图圆角,初始化效果
							color:'#91c7ae',
							barBorderRadius:[10, 10, 0, 0],
							label: {
								show: true,//是否展示
								textStyle: {
									fontWeight:'bolder',
									fontSize : '12',
									fontFamily : '微软雅黑',
								}
							}
						},
					},
					label: {
						normal: {
							show: true,
							position: 'inside'
						}
					},
					data: this.failData,
				},
			]
		};
    myChart1.setOption(option1);

html中

在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值