djangobokehjs

Resize bokeh plot from CustomJS


Resize bokeh plot from CustomJS.

window.setXYDimension = function (width, height) {
  fig.plot_width  = width;
  fig.plot_height = height;
  console.log({fig});
  fig.reset(); //reset doesn't exist
  fig.resize(); //resize doesn't exist
  fig.layout(); //layout doesn't exist
};

Any help is appreciated.


Solution

  • This worked.

    window.setXYDimension = function (width, height) {
      fig.frame_width  = width;
      fig.frame_height = height;
      fig.properties.width.change.emit();
      fig.properties.height.change.emit();
    };
    

    Thank You to Smiley for the solution.