Author: Lars Michelsen <[email protected]>
Date: Mon Sep 5 13:25:06 2011 +0200
Committer: Lars Michelsen <[email protected]>
Commit-Date: Mon Sep 5 13:25:06 2011 +0200
Bugfix: std_speedometer.php fixed min/max handling (Thanks to foxkilo)
---
share/userfiles/gadgets/std_speedometer.php | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/share/userfiles/gadgets/std_speedometer.php
b/share/userfiles/gadgets/std_speedometer.php
index 3f0eafc..c7546c6 100644
--- a/share/userfiles/gadgets/std_speedometer.php
+++ b/share/userfiles/gadgets/std_speedometer.php
@@ -96,9 +96,9 @@ if(intval($max) == 0 || $max == '')
// Calculate degrees of value, warn, critical
//================
-$p = 180 / $max * $value;
-$warnp = -180 + (180 / $max * $warn);
-$critp = -180 + (180 / $max * $crit);
+$p = 180 / ( $max + $min ) * $value;
+$warnp = -180 + (180 / ( $max - $min ) * ( $warn - $min ) );
+$critp = -180 + (180 / ( $max - $min ) * ( $crit - $min ) );
// If the critp is bigger than -1 it can not be rendered by the php functions.
// Set it to -1 for having at least a small critical area drawn
@@ -176,7 +176,7 @@ imagefilledarc($img, ($centerx-$diffx), ($centery+$diffy),
($outerdia+10), ($out
// Speedometer labels
imageline($img, ($centerx-$outerdia/2-5), ($centery+1),
($centerx+$outerdia/2+5), ($centery+1), $oBlack);
-imagestring($img, 1, ($centerx-$outerdia/2-15), ($centery-6), 0, $oBlack);
+imagestring($img, 1, ($centerx-$outerdia/2-15), ($centery-6), $min , $oBlack);
imagestring($img, 1, ($centerx+$outerdia/2+8), ($centery-6), $max, $oBlack);
$count = 1;
@@ -188,7 +188,7 @@ for($degrees=45; $degrees<180; $degrees = $degrees+45) {
$bediffx1=cos (deg2rad(-$degrees+360))*(($outerdia-10)/2);
imageline($img, ($centerx-$bediffx),
($centery+$bediffy),($centerx-$bediffx1), ($centery+$bediffy1), $oBlack);
- imagestring($img , 1 ,($centerx-$bediffx+$iOffsetX-8),
($centery+$bediffy-10) , ($max/4*$count) , $oBlack);
+ imagestring($img , 1 ,($centerx-$bediffx+$iOffsetX-8),
($centery+$bediffy-10) , (($max-$min)/4*$count+$min) , $oBlack);
$count = $count+1;
$iOffsetX = $iOffsetX + 10;
------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins