When echarts has multiple polylines, one is displayed by default

Requirement: There are currently 4 polylines, and only two polylines are displayed by default.
insert image description here
After reading the documentation of echarts, the selected of the legend attribute can be controlled
insert image description here

legend: {
    
    
		orient: "vertical",
		show: _this.legendShow,
		top: 120,
		right: -10,
		textStyle: {
    
    
			color: "rgba(255, 255, 255, 0.7)",
		},
		data: ["订单量", "交货量", "发货量(过账)", "缺货量"],
		selected: {
    
     //在这里设置就ok了
			'订单量': true,
			'交货量': false,
			'发货量(过账)':true,
			'缺货量':false
		}
	},

result:
insert image description here

Guess you like

Origin blog.csdn.net/weixin_42821697/article/details/123827096
Recommended