1.实现这样的一个图
2.主要代码
option = {
title: {
text: 'Stacked Line'
},
tooltip: {
trigger: 'axis',
},
legend: {
data: ['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
emphasis: {
itemStyle: {
color: 'blue',
borderColor: '#556FFD',
borderWidth: 1
},
},
xAxis: {
type: 'category',
boundaryGap: false,
splitLine:{
show:true,
lineStyle:{
type:'dashed'
},
},
axisPointer: {
show: true,
lineStyle: {
color: "#23ADFF",
width: 2,
},
},
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value',
splitLine:{
show:true,
lineStyle:{
type:'dashed'
}
}
},
series: [
{
name: 'Search Engine',
type: 'line',
stack: 'Total',
symbolSize: 9,
areaStyle:{
color: new echarts.graphic.LinearGradient(
0, 0, 0, 1,
[
{offset: 0, color: 'rgba(0,0,255,0.1)'},
{offset: 0.6, color: 'transparent'}
]
),
},
data: [820, 932, 901, 934, 1290, 1330, 1320],
smooth: 0.6,
lineStyle: {
color: '#5470C6',
width: 5
},
}
]
};