动态切换,图例会改变echarts 柱状配置项内容和展示

点击右上角切换柱状图,柱子大小和图例上方图标说明会改变

配置项如下
      option = {
  
		title: {
			text: '实例',
			show: '',
		},
		tooltip: {},
		legend: {
			data: ['销量','均线']
		},
		toolbox:{
			show:true,
			orient:'vertical',
			feature:{
				magicType:{
					show:true,
					type:['line','bar']
				}
			}
		},
		xAxis: {
			data: ["衬衫", "裤子", "毛衣", "牛仔裤", "口罩"]
		},
		yAxis: {},
		series: [{
				name: '销量',
				type: 'bar',
				data: [5, 6, 7, 8, 9]
				}, 
				{
				name: '均线',
				type: 'line',
				markLine: {
					data: [{
						yAxis: 2.5,
						symbolSize: 1,
						lineStyle: {
							normal: {
								color: '#eddb93',
								width: 2
							}
						}
					}]
				}
			}

		]
	
};
    
截图如下