The size of the echarts chart changes with the size of the external div

First create a chart array externally.

var chartsArr=[];

Put in the chart that needs to be size-responsive.

myChart1.setOption(option1);
chartsArr.push(myChart1);  


myChart2.setOption(option2);
chartsArr.push(myChart2);

 Then there is the click event to modify the div size:

function bigEcharts() {

  $(".righthidden").css({"width":"70%"});  //修改大小

        for(var i=0;i<chartsArr.length;i++){
            chartsArr[i].resize();
    
            }

}

 

Guess you like

Origin blog.csdn.net/weixin_38959210/article/details/107764272