Resize issue while gridster.js with highcharts

前端 未结 3 1364
-上瘾入骨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条回答
  •  Happy的楠姐
    2021-01-07 00:12

    you can use resize callback

      $(document).ready(function () {
      gridster = $(".gridster ul").gridster({
          widget_base_dimensions: ['auto', 140],
          autogenerate_stylesheet: true,
          min_cols: 1,
          max_cols: 6,
          widget_margins: [5, 5],
          resize: {
              enabled: true,
              resize: function (e, ui, $widget) {
                  Highcharts.charts[0].reflow(); // reflow the first chart...
              },
              stop: function(e, ui, $widget) {
                  Highcharts.charts[0].reflow(); // reflow the first chart...
                }
          }
      }).data('gridster');
      $('.gridster  ul').css({'padding': '0'});
    });
    

提交回复
热议问题