Make log scales more robust
This commit is contained in:
parent
2e8641ad18
commit
206be6a8fa
|
@ -139,9 +139,13 @@ class TimeSeries(Widget):
|
|||
|
||||
def v2y(v):
|
||||
if self.yscale == "log":
|
||||
return (1 - math.log(v / min_value)
|
||||
try:
|
||||
return (1 - math.log(max(v, min_value) / min_value)
|
||||
/ 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":
|
||||
return (1 - v/max_value) * 200
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue