From 1b6c4e933ade3f03d634dfaa6357e82beda3bc55 Mon Sep 17 00:00:00 2001 From: "Alexander O. Anisimov" Date: Fri, 27 Jan 2012 20:28:05 +0600 Subject: [PATCH 1/2] Add passing amount and center over plotzoom event --- jquery.flot.navigate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.flot.navigate.js b/jquery.flot.navigate.js index f2b9760..88d0a87 100644 --- a/jquery.flot.navigate.js +++ b/jquery.flot.navigate.js @@ -262,7 +262,7 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L plot.draw(); if (!args.preventEvent) - plot.getPlaceholder().trigger("plotzoom", [ plot ]); + plot.getPlaceholder().trigger("plotzoom", [ plot, args ]); } plot.pan = function (args) { From e60344561f9891ad019b2811a5183ac5a4fe04d5 Mon Sep 17 00:00:00 2001 From: "Alexander O. Anisimov" Date: Fri, 27 Jan 2012 23:40:44 +0600 Subject: [PATCH 2/2] Fixed overrun panRange while zooming --- jquery.flot.navigate.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/jquery.flot.navigate.js b/jquery.flot.navigate.js index 88d0a87..9e95cc9 100644 --- a/jquery.flot.navigate.js +++ b/jquery.flot.navigate.js @@ -234,7 +234,8 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L var opts = axis.options, min = minmax[axis.direction].min, max = minmax[axis.direction].max, - zr = opts.zoomRange; + zr = opts.zoomRange, + pr = opts.panRange; if (zr === false) // no zooming on this axis return; @@ -248,6 +249,16 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L max = tmp; } + //Check that we are in panRange + if (pr) { + if (pr[0] != null && min < pr[0]) { + min = pr[0]; + } + if (pr[1] != null && max > pr[1]) { + max = pr[1]; + } + } + var range = max - min; if (zr && ((zr[0] != null && range < zr[0]) ||