Adjusting Y-axis after zooming using Selection

38 views
Skip to first unread message

Brian Shiau

unread,
Oct 5, 2015, 10:52:38 AM10/5/15
to Flot graphs

I have it set up to zoom to a range of x values using the lower overview chart. I would like the zoomed result in the main chart to adjust the Y-axis (all 3) based on the min and max y-values in the zoomed set. How can I do this? Thanks.

This is my code:

$("#placeholder").bind("plotselected", function (event, ranges) {

// do the zooming
$.each(plot.getXAxes(), function(_, axis) {
var opts = axis.options;
opts.min = ranges.xaxis.from;
opts.max = ranges.xaxis.to;
});

plot.setupGrid();
plot.draw();
plot.clearSelection();

// don't fire event on the overview to prevent eternal loop
overview.setSelection(ranges, true);
});

$("#overview").bind("plotselected", function (event, ranges) {
plot.setSelection(ranges);
});
  //end of zoom tool
Reply all
Reply to author
Forward
0 new messages