Module: check_mk
Branch: master
Commit: 64a16e919888def38b10a596ce8e84247bf21139
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=64a16e919888de…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Oct 14 12:02:41 2014 +0200
#1077 FIX Fixed labelling of Y achsis in prediction graphs
In some cases the vertical achsis was not labelled. This has
been fixed.
---
.werks/1077 | 11 +++++++++++
ChangeLog | 1 +
web/htdocs/prediction.py | 13 ++++++++++++-
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/.werks/1077 b/.werks/1077
new file mode 100644
index 0000000..cc89a40
--- /dev/null
+++ b/.werks/1077
@@ -0,0 +1,11 @@
+Title: Fixed labelling of Y achsis in prediction graphs
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.5i6
+Date: 1413280924
+
+In some cases the vertical achsis was not labelled. This has
+been fixed.
diff --git a/ChangeLog b/ChangeLog
index d124b02..c369389 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -119,6 +119,7 @@
* 1120 FIX: Multisite filters Host/Service Contactgroup: Fixed livestatus
exception...
* 1158 FIX: Moved filter logic to visuals module...
NOTE: Please refer to the migration notes!
+ * 1077 FIX: Fixed labelling of Y achsis in prediction graphs...
WATO:
* 1096 New WATO webservices: manage hosts via webinterface...
diff --git a/web/htdocs/prediction.py b/web/htdocs/prediction.py
index c2c6ee5..b1a1059 100644
--- a/web/htdocs/prediction.py
+++ b/web/htdocs/prediction.py
@@ -159,7 +159,7 @@ vranges = [
def compute_vertical_scala(low, high):
m = max(abs(low), abs(high))
for letter, factor in vranges:
- if m <= 15 * factor:
+ if m <= 99 * factor:
break
else:
letter = 'P'
@@ -172,6 +172,10 @@ def compute_vertical_scala(low, high):
step = 0.2 * factor
elif steps < 6:
step = 0.5 * factor
+ elif steps > 50:
+ step = 5 * factor
+ elif steps > 20:
+ step = 2 * factor
else:
step = factor
@@ -184,6 +188,13 @@ def compute_vertical_scala(low, high):
vert_scala = [ [v, "%.1f%s" % (v / factor, letter)] ] + vert_scala
v -= step
+ # Remove trailing ".0", if that is present for *all* entries
+ for entry in vert_scala:
+ if not entry[1].endswith(".0"):
+ break
+ else:
+ vert_scala = [ [e[0],e[1][:-2]] for e in vert_scala ]
+
return vert_scala
def get_current_perfdata(host, service, dsname):