Make log scales more robust
This commit is contained in:
parent
2e8641ad18
commit
206be6a8fa
10
dashboard.py
10
dashboard.py
|
@ -139,9 +139,13 @@ class TimeSeries(Widget):
|
||||||
|
|
||||||
def v2y(v):
|
def v2y(v):
|
||||||
if self.yscale == "log":
|
if self.yscale == "log":
|
||||||
return (1 - math.log(v / min_value)
|
try:
|
||||||
/ math.log(max_value / min_value)
|
return (1 - math.log(max(v, min_value) / min_value)
|
||||||
) * 200
|
/ math.log(max_value / min_value)
|
||||||
|
) * 200
|
||||||
|
except ValueError:
|
||||||
|
log.error(f"ValueError: v = {v}, min_value = {min_value}, max_value = {max_value}")
|
||||||
|
return 0
|
||||||
elif self.yscale == "linear":
|
elif self.yscale == "linear":
|
||||||
return (1 - v/max_value) * 200
|
return (1 - v/max_value) * 200
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue