Reputation: 99
I created an array that contains all of the flot objects on the screen. Using the selection plugin, I am implementing a zoom feature.
Unfortunately, the code below does not work as expected. I can confirm with console.log
that the options change. The clearSelection()
also works but the graph never redraws.
Also, I don't think it matters but I'm using a time-based x-axis.
$(".flot").bind("plotselected", function (event, ranges) {
var plot = flots['#'+event.target.id];
plot.getOptions().xaxis.min = ranges.xaxis.from;
plot.getOptions().xaxis.max = ranges.xaxis.to;
plot.setupGrid();
plot.clearSelection();
plot.draw();
});
Upvotes: 0
Views: 37
Reputation: 99
I figured it out. For some reason I had to change the axes min and max using the xaxes[0].min and yaxes[0].min.
$(".flot").bind("plotselected", function (event, ranges) {
var plot = flots['#'+event.target.id];
plot.getOptions().xaxes[0].min = ranges.xaxis.from;
plot.getOptions().xaxes[0].max = ranges.xaxis.to;
plot.setupGrid();
plot.clearSelection();
plot.draw();
});
Upvotes: 2