option = {
title: {
text: '折线图'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['邮件营销', '联盟广告']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: [
{
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
axisTick: {
alignWithLabel: true
}
}
],
yAxis: {
type: 'value'
},
series: [
{
name: '邮件营销',
type: 'line',
stack: '总量',
label: {
normal: {
show: true,
position: 'top'
}
},
data: [120, 132, 190, 180, 150, 280, 210]
},
{
name: '联盟广告',
type: 'line',
stack: '总量',
label: {
normal: {
show: true,
position: 'top'
}
},
data: [220, 182, 191, 234, 290, 330, 310],
},
]
};
将type: 'line'改为type: 'bar',得柱状堆叠图 。