Plot targets can be placed inside of resizable containers for dynamic plot sizing. The examples here use the jQuery UI package for resizing functionality.

The first plot has good resize performance in Firefox, Safari and other canvas enabled browsers. The plot will resize dynamically with the container. IE performance will be slow since IE doesn't natively support the canvas element.

Resizing is handled by binding a handler to the 'resize' event. The handler function replots the plot during resize. Here, the plot targets's height and width must be specified as a percentage of the container and the container must be visible.

The event handler looks like:

    $('#resizable1').bind('resize', function(event, ui) {
        plot1.replot( { resetAxes: true } );

The second plot uses an alternative sizing method that is more responsive in all browsers, especially IE. The difference? First, the plot target is given a static height and width that will fit inside the resizable container. Then, instead of resizing dynamically with the container, the plots replot() method is called at the end of the resize. When resizing is done, the plot targets height and width are set to a percentage of the container's and then the replot method is called.

Also, an options object is passed into the replot method. It contains a single option, resetAxes, which, if true, resets all axes so the min, max, numberTicks and tickInterval are recalculated.

    $('#resizable2').bind('resizestop', function(event, ui) {

You can also pass in option objects to reset specific axes like:

    {resetAxes:['yaxis', 'y2axis']};
    {resetAxes:{yaxis:true, y2axis:true}};

The third plot shows resizing with a Meter Gauge plot. Since a Meter Gauge doesn't have axes, resetAxes: trues doesn't have any effect. Instead, jqPlot will resize the chart if you set pretty much any other option (in this example, the title is set).