html
option1:{},
e-chart 自适应
this.option1 = option
myChart.setOption(this.option1, true);
window.onresize = () => {
myChart.resize();
};
js代码
// 全选反选
pitchOn(index) {
this.btnindex = index
let myChart = echarts.init(document.getElementById(‘min1’));
let selectArr = myChart.getOption().legend[0].data;
var obj1 = {};
if (this.btnindex == 0) {
var val = true;
} else if (this.btnindex == 1) {
var val = false;
}
for (var key in selectArr) {
obj1[selectArr[key]] = val;
}
this.option1.legend.selected = obj1;
myChart.setOption(this.option1);
},