var option = {
title: {
text: '堆积图示例'
},
tooltip: {},
legend: {
data: ['系列1', '系列2', '系列3']
},
xAxis: {
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
},
yAxis: {},
series: [{
name: '系列1',
type: 'bar',
stack: '总量',
data: [120, 132, 101, 134, 90, 230, 210]
}, {
name: '系列2',
type: 'bar',
stack: '总量',
data: [220, 182, 191, 234, 290, 330, 310]
}, {
name: '系列3',
type: 'bar',
stack: '总量',
data: [150, 232, 201, 154, 190, 330, 410]
}]
};
备注:series里每个数据系列都需要指定type为’bar’,stack属性用来指定该系列数据与哪些系列数据堆积在一起,data属性是用来指定该系列数据的具体值。
