[smokeping-users] zooming out revisited
Tobias Oetiker
tobi at oetiker.ch
Mon Sep 17 22:48:23 CEST 2007
Folks,
I just added this patch to the javascript zooming code ...
When you extend the selected area over the graph, you will get a reasonable zoomout behaviour.
cheers
tobi
PS the demo site is updated
--- cropper/smokeping-zoom.js (revision 834)
+++ cropper/smokeping-zoom.js (revision 837)
@@ -55,11 +55,20 @@
var myURL = myURLObj.getUrlBase();
// Generate Selected Range in Unix Timestamps
+ var LeftFactor = 1;
+ var RightFactor = 1;
- var NewStartEpoch = Math.floor(StartEpoch + (SelectLeft - RRDLeft) * DivEpoch / RRDImgUsable );
- EndEpoch = Math.ceil(StartEpoch + (SelectRight - RRDLeft) * DivEpoch / RRDImgUsable );
- StartEpoch = NewStartEpoch;
+ if (SelectLeft < RRDLeft)
+ LeftFactor = 10;
+ StartEpoch = Math.floor(StartEpoch + (SelectLeft - RRDLeft) * DivEpoch / RRDImgUsable * LeftFactor );
+
+ if (SelectRight > RRDImgWidth - RRDRight)
+ RightFactor = 10;
+
+ EndEpoch = Math.ceil(EndEpoch + (SelectRight - (RRDImgWidth - RRDRight) ) * DivEpoch / RRDImgUsable * RightFactor);
+
+
$('zoom').src = myURL + '?displaymode=a;start=' + StartEpoch + ';end=' + EndEpoch + ';target=' + Target;
myCropper.setParams();
--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten
http://it.oetiker.ch tobi at oetiker.ch ++41 62 213 9902
More information about the smokeping-users
mailing list