From e70158250f876e45867f72366a88598de8915774 Mon Sep 17 00:00:00 2001 From: Antti Koponen Date: Fri, 23 Apr 2021 08:39:16 +0300 Subject: [PATCH] Fix Highcharts dark mode switching (#1861) * Fix Highcharts dark mode switching Dark/light mode wasn't getting applied because of empty graph objects in the graphs array. Includes a hack for Highcharts directly mutating the passed theme object on every update() call. --- .../src/main/resources/assets/plan/web/js/graphs.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Plan/common/src/main/resources/assets/plan/web/js/graphs.js b/Plan/common/src/main/resources/assets/plan/web/js/graphs.js index 080c7b1ed..7344dc9a2 100644 --- a/Plan/common/src/main/resources/assets/plan/web/js/graphs.js +++ b/Plan/common/src/main/resources/assets/plan/web/js/graphs.js @@ -711,7 +711,13 @@ function worldPie(id, worldSeries, gmSeries) { } function updateGraphs() { - for (let graph of graphs) { + const scrollbar = {...Highcharts.theme.scrollbar}; + graphs.forEach((graph, index, array) => { + if (Object.keys(graph).length === 0) { + array.splice(index, 1); + return; + } + Highcharts.theme["scrollbar"] = {...scrollbar}; graph.update(Highcharts.theme); - } -} \ No newline at end of file + }) +}