From 26703911123f88cbc11b72844fd63cffa995c778 Mon Sep 17 00:00:00 2001 From: Lutz Bender Date: Wed, 26 Mar 2025 12:27:46 +0100 Subject: [PATCH] add configurable chart range --- .../web_themes/standard_legacy/config.py | 6 +- .../web/electricityPriceChart.js | 4 +- .../web_themes/standard_legacy/web/index.html | 12 +-- .../standard_legacy/web/livechart.js | 13 +-- .../standard_legacy/web/processAllMqttMsg.js | 96 +++++++++++-------- .../standard_legacy/web/setupMqttServices.js | 3 +- .../standard_legacy/web/smartHome.html | 20 ++-- 7 files changed, 80 insertions(+), 74 deletions(-) diff --git a/packages/modules/web_themes/standard_legacy/config.py b/packages/modules/web_themes/standard_legacy/config.py index 83cb7ab8c6..9208436b08 100644 --- a/packages/modules/web_themes/standard_legacy/config.py +++ b/packages/modules/web_themes/standard_legacy/config.py @@ -5,8 +5,10 @@ @auto_str class StandardLegacyWebThemeConfiguration: - def __init__(self) -> None: - pass + def __init__(self, + history_chart_range: int = 30 * 60 * 1000 # 30 minutes in milliseconds + ) -> None: + self.history_chart_range = history_chart_range @auto_str diff --git a/packages/modules/web_themes/standard_legacy/web/electricityPriceChart.js b/packages/modules/web_themes/standard_legacy/web/electricityPriceChart.js index 2d7328b2c4..96603f1574 100644 --- a/packages/modules/web_themes/standard_legacy/web/electricityPriceChart.js +++ b/packages/modules/web_themes/standard_legacy/web/electricityPriceChart.js @@ -100,9 +100,9 @@ function loadElectricityPriceChart() { ], } - var ctxElectricityPricechart = $('#electricityPriceChartCanvas')[0].getContext('2d'); + var ctxElectricityPriceChart = $('#electricityPriceChartCanvas')[0].getContext('2d'); - window.electricityPricechart = new Chart(ctxElectricityPricechart, { + window.electricityPriceChart = new Chart(ctxElectricityPriceChart, { type: 'line', data: electricityPriceChartData, options: { diff --git a/packages/modules/web_themes/standard_legacy/web/index.html b/packages/modules/web_themes/standard_legacy/web/index.html index 2b2fe2e0d1..36132c1147 100644 --- a/packages/modules/web_themes/standard_legacy/web/index.html +++ b/packages/modules/web_themes/standard_legacy/web/index.html @@ -1057,11 +1057,11 @@