Fix linear yscale

This commit is contained in:
Peter J. Holzer 2023-01-01 01:05:38 +01:00 committed by Peter J. Holzer
parent 4380210c34
commit f62816a250
1 changed files with 2 additions and 1 deletions

View File

@ -164,7 +164,7 @@ class TimeSeries(Widget):
/ math.log(max_value / min_value) / math.log(max_value / min_value)
) * 200 ) * 200
elif self.yscale == "linear": elif self.yscale == "linear":
return (1 - v/max_value) * 200, return (1 - v/max_value) * 200
else: else:
raise ValueError(f"Unknown yscale {self.yscale}") raise ValueError(f"Unknown yscale {self.yscale}")
@ -413,6 +413,7 @@ class TimeSeries(Widget):
html += f"<line x1={tm['x']} y1=0 x2={tm['x']} y2=200 stroke='#CCC' />" html += f"<line x1={tm['x']} y1=0 x2={tm['x']} y2=200 stroke='#CCC' />"
html += f"<text transform='translate({tm['x']}, 210) rotate(30)' fill='#888'>{tm['t_h']}</text>" html += f"<text transform='translate({tm['x']}, 210) rotate(30)' fill='#888'>{tm['t_h']}</text>"
for tm in self.y_tickmarks: for tm in self.y_tickmarks:
log.debug("tm = %s", tm)
html += f"<line x1=0 y1={tm['y']} x2=1000 y2={tm['y']} stroke='#CCC' />" html += f"<line x1=0 y1={tm['y']} x2=1000 y2={tm['y']} stroke='#CCC' />"
html += f"<text x=1005 y={tm['y']} fill='#888'>{tm['v_h']}</text>" html += f"<text x=1005 y={tm['y']} fill='#888'>{tm['v_h']}</text>"
for v in v_data: for v in v_data: