同一个dom绘制两个bar图,第二个显示不贴X轴
配置项如下
app.title = '堆叠条形图';
option = {
tooltip : {
trigger: 'axis',
axisPointer : { // 坐标轴指示器,坐标轴触发有效
type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
legend: [
{
data: ['直接访问', '邮件营销','联盟广告'],
left: '3%'
},{
data: ['视频广告','搜索引擎'],
left: '50%'
}
],
grid: [{
left: '3%',
bottom: '3%',
width: '40%',
containLabel: true
},{
left: '50%',
bottom: '3%',
width: '40%',
containLabel: true
}],
xAxis: [ {
gridIndex: 0,
type: 'category',
data: ['周一','周二','周三']
}, {
gridIndex: 1,
type: 'category',
data: ['周六','周日']
}],
yAxis: [{
gridIndex: 0,
type: 'value'
},{
gridIndex: 1,
type: 'value'
}],
series: [
{
name: '直接访问',
xAxisIndex: 0,
yAxisIndex: 0,
type: 'bar',
stack: '总量',
label: {
normal: {
show: true,
position: 'insideRight'
}
},
data: [320, 302, 301]
},
{
name: '邮件营销',
xAxisIndex: 0,
yAxisIndex: 0,
type: 'bar',
stack: '总量',
label: {
normal: {
show: true,
position: 'insideRight'
}
},
data: [120, 132, 101]
},
{
name: '联盟广告',
xAxisIndex: 0,
yAxisIndex: 0,
type: 'bar',
stack: '总量',
label: {
normal: {
show: true,
position: 'insideRight'
}
},
data: [220, 182, 191]
},
{
name: '视频广告',
xAxisIndex: 1,
yAxisIndex: 1,
type: 'bar',
stack: '总量1',
label: {
normal: {
show: true,
position: 'insideRight'
}
},
data: [330, 410]
},
{
name: '搜索引擎',
xAxisIndex: 1,
yAxisIndex: 1,
type: 'bar',
stack: '总量1',
label: {
normal: {
show: true,
position: 'insideRight'
}
},
data: [1330, 1320]
}
]
};