Fix formatting of time values in graph descriptions

This commit is contained in:
Peter J. Holzer 2024-08-24 23:07:05 +02:00
parent 1a798be52d
commit 2016fb4a0e
2 changed files with 5 additions and 2 deletions

View File

@ -392,6 +392,7 @@ class TimeSeries(Widget):
max_value = max([d[3] if len(d) >= 4 else d[1] for d in self.lts.data])
max_value = max(max_value, 0.001) # ensure positive
unit = self.lts.description["unit"]
if self.yscale == "log":
try:
min_value = min(d[1] for d in self.lts.data if d[1] > 0)
@ -471,7 +472,8 @@ class TimeSeries(Widget):
log.debug("in as_html")
return Markup(render_template("timeseries.html", widget=self))
def format_time(seconds):
def format_time(self, seconds):
value = seconds
unit = "s"
if value >= 365.25 * 86400:
value /= 365.25 * 86400

View File

@ -8,8 +8,9 @@
body {
font-family: sans-serif;
}
th {
th, td {
text-align: left;
vertical-align: baseline;
}
main {
display: flex;