Use special log scale for time values
Seconds are a bit unintuitive for everything above 1 hour.
This commit is contained in:
parent
fedc4c66ac
commit
4b6e6c6eed
15
dashboard.py
15
dashboard.py
|
@ -314,6 +314,21 @@ class TimeSeries(Widget):
|
||||||
v += step
|
v += step
|
||||||
log.debug("")
|
log.debug("")
|
||||||
elif self.yscale == "log":
|
elif self.yscale == "log":
|
||||||
|
unit = self.lts.description["unit"]
|
||||||
|
if unit == "s" and max_value > 3600:
|
||||||
|
steps = (
|
||||||
|
(3600, "1 h"),
|
||||||
|
(86400, "1 d"),
|
||||||
|
(7*86400, "1 w"),
|
||||||
|
(28*86400, "4 w"),
|
||||||
|
(365*86400, "1 y"),
|
||||||
|
(3652.5 * 86400, "10 y"),
|
||||||
|
)
|
||||||
|
for s in steps:
|
||||||
|
if min_value <= s[0] <= max_value:
|
||||||
|
self.y_tickmarks.append({"y": v2y(s[0]), "v_h": s[1]})
|
||||||
|
|
||||||
|
else:
|
||||||
log.debug("")
|
log.debug("")
|
||||||
v = 10 ** math.ceil(math.log10(min_value))
|
v = 10 ** math.ceil(math.log10(min_value))
|
||||||
log.debug("v = %s", v)
|
log.debug("v = %s", v)
|
||||||
|
|
Loading…
Reference in New Issue