Santhosh S
Santhosh S

Reputation: 1159

How to disable panning in Jquery flot when there is no further data?

How to disable panning in Jquery flot when there is no further data ?

I am currently using plot.pan({ left: -100 }); and plot.pan({ left: 100 }); on left arrow click and right arrow click.

Upvotes: 4

Views: 1877

Answers (2)

F4bio16
F4bio16

Reputation: 79

this work for me:

axis = plot.getAxes();
axis.xaxis.options.panRange = [axis.xaxis.datamin, axis.xaxis.datamax];

// for redraw

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

Upvotes: 1

Jawa
Jawa

Reputation: 2332

I've handeled panning limitation by setting the panRange option every time the plot's data values change. This way you don't need any other changes, the navigation plugin will do the rest.

plot.getOptions().xaxis.panRange =
  [plot.getAxes().xaxis.datamin, plot.getAxes().xaxis.datamax];
plot.getOptions().yaxis.panRange =
  [plot.getAxes().yaxis.datamin, plot.getAxes().yaxis.datamax];

Upvotes: 2

Related Questions