Resize issue while gridster.js with highcharts

前端 未结 3 1381
-上瘾入骨i
-上瘾入骨i 2021-01-06 23:42

Highcharts inside the gridster widgets not resize automatically when I resize the gridster widgets. When I resize the window, highchart are resized based on the grid sizes.

3条回答
  •  猫巷女王i
    2021-01-07 00:20

    In my case chart.reflow() wasn't good. You can use chart.setSize(width, height)

    I have event on resize.stop callback and listener in function responsible for drawing charts which contains:

    var height = $('#HighartsContainer').closest("li").height() - 50; //50: margin, padding, etc
    var width = $('#HighartsContainer').closest("li").width() - 10;
    

    you can also set new height or weight of container:

    $('#HighartsContainer').css('height', height);
    
    self.chart.setSize(width, height, false);
    

提交回复
热议问题