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'
}
},
legend: {
data: ['成功次数', '失败次数'],
left: '60%',
},
grid: {
left: '10%',
right: '10%',
bottom: '3%',
containLabel: true
},
xAxis: {
name : '操作类型',
type: 'category',
data: this.typesData,
},
yAxis: {
type: 'value',
splitLine:{
show:true,
lineStyle:{
color:'#DCDCDC',
width: 1,
type: 'dotted',
},
},
splitNumber: 10,
},
series: [
{
name: '成功次数',
type: 'bar',
stack: '次数',
barWidth : 20,
itemStyle:{
normal: {
color:'#d48265',
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);