From 107764c6be516ef01fc9129b0a75eda1012857ac Mon Sep 17 00:00:00 2001 From: Nic Limper Date: Wed, 19 Mar 2025 23:18:30 +0100 Subject: [PATCH] fixed y-axis labels on dayahead prices (https://github.com/OpenEPaperLink/OpenEPaperLink/issues/446) --- ESP32_AP-Flasher/src/contentmanager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ESP32_AP-Flasher/src/contentmanager.cpp b/ESP32_AP-Flasher/src/contentmanager.cpp index d811bd51..e00f4e5c 100644 --- a/ESP32_AP-Flasher/src/contentmanager.cpp +++ b/ESP32_AP-Flasher/src/contentmanager.cpp @@ -1660,7 +1660,10 @@ bool getDayAheadFeed(String &filename, JsonObject &cfgobj, tagRecord *&taginfo, for (double i = minPrice; i <= maxPrice; i += yAxisScale.step) { int y = mapDouble(i, minPrice, maxPrice, spr.height() - barBottom, spr.height() - barBottom - loc["bars"][2].as()); spr.drawLine(0, y, spr.width(), y, TFT_BLACK); - if (loc["yaxis"][0]) drawString(spr, String(int(i * units)), yAxisX, y - yAxisY, loc["yaxis"][0], TL_DATUM, TFT_BLACK); + if (loc["yaxis"][0]) { + String label = (maxPrice * units < 10) ? String(i * units, 1) : String(int(i * units)); + drawString(spr, label, yAxisX, y - yAxisY, loc["yaxis"][0], TL_DATUM, TFT_BLACK); + } } uint16_t barwidth = loc["bars"][1].as() / n;