From 2016fb4a0e3bddef612aa0064c49632f6ab4e2d7 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Sat, 24 Aug 2024 23:07:05 +0200 Subject: [PATCH] Fix formatting of time values in graph descriptions --- dashboard.py | 4 +++- templates/dashboard.html | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dashboard.py b/dashboard.py index 3339dc5..5cc6ddc 100644 --- a/dashboard.py +++ b/dashboard.py @@ -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 diff --git a/templates/dashboard.html b/templates/dashboard.html index 20e3ac3..d338b08 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -8,8 +8,9 @@ body { font-family: sans-serif; } - th { + th, td { text-align: left; + vertical-align: baseline; } main { display: flex;