The jquery.flot.navigate.js plugin adds panning and zooming capabilities to a Flot plot. By default, it enables zooming via the scrollwheel (up/down) and panning via dragging.
It provides programmatic control through the following API methods:
plot.zoom({ center }): Zooms in at a specific pixel location.plot.zoomOut({ center }): Zooms out at a specific pixel location.plot.pan({ left, top }): Pans the plot by a specific pixel offset.
Note: The center and offset values are defined in pixel space, not data space. You can use Flot's p2c (pixel-to-coordinate) helpers on the axes to convert between these spaces.
plot = $.plot(...);
// zoom default amount in on the pixel ( 10, 20 )
plot.zoom({ center: { left: 10, top: 20 } });
// zoom out again
plot.zoomOut({ center: { left: 10, top: 20 } });
// zoom 200% in on the pixel (10, 20)
plot.zoom({ amount: 2, center: { left: 10, top: 20 } });
// pan 100 pixels to the left and 20 down
plot.pan({ left: -100, top: 20 });