我正在为我的图表尝试Echarts library。我想在窗口的调整大小触发器被触发时调整大小,但我找不到方法。
Thanx求助
答案 0 :(得分:19)
var plot = echarts.init(yourDom);
plot.setOption({...});
window.onresize = function() {
plot.resize();
};
答案 1 :(得分:6)
window.onresize = function() {
$(".ga-charts").each(function(){
var id = $(this).attr('_echarts_instance_');
window.echarts.getInstanceById(id).resize();
});
};
答案 2 :(得分:0)
var allCharts = $('.charts');
setTimeout(function(){
for(var i=0;i<allCharts.length;i++){
var $item = $(allCharts[i]);
echarts.getInstanceById($item.attr('_echarts_instance_')).resize();
}
},100) `