Reacting to Resize Events

If you want to design your custom charts to be ‚Äúresponsive‚ÄĚ, it is imperative to be notified when a user resizes the chart widget to account for the new widget dimensions. You specify your own resize handler function by overriding the controller.resize method.

Example:

controller.resize = function(newWidth, newHeight) {
  // If needed, use the newWidth and newHeight values to re-size chart  
}

The specified handler executes every time a user action causes the widget dimensions to change. The following list provides a few examples of actions that trigger the resize event:

  • A user changes the dimensions of the browser window
  • A user changes the dimensions of the individual widget
  • Hiding or displaying controls like the Time Bar may reduce/increase the space available for widgets in a dashboard