当动态改变option配置项的series和legend的data长度,例如:由一个改变为三个在改变为一个,此时,图表仍显示三个折线图,但是legend会只显示一个
配置项如下
option = {
tooltip: {
trigger: 'axis'
},
legend: {
data: [],
textStyle: {
color: 'RGB(255,255,255)'
}
},
grid: {
left: '3%',
right: '5%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
boundaryGap: false,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
splitLine: {
show: false
},
axisLine: {
lineStyle: {
type: 'dash',
color: 'RGB(255,255,255)'
}
},
axisLabel: {
interval: 0,
textStyle: {
fontSize: 8,
},
}
},
yAxis: {
type: 'value',
axisLine: {
show: false,
lineStyle: {
color: 'RGB(255,255,255)'
}
},
splitLine: {
lineStyle: {
type: 'dash',
color: "silver"
}
},
axisTick: {
show: false
}
},
series: []
};