From 1dba84956703eea50edfc4448fb94aec20c696d8 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Wed, 6 Apr 2022 20:54:11 +0200 Subject: [PATCH] Fix statistics chart for sum stat without state (#12238) --- src/components/chart/statistics-chart.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/chart/statistics-chart.ts b/src/components/chart/statistics-chart.ts index 944b467a41..9f793a6977 100644 --- a/src/components/chart/statistics-chart.ts +++ b/src/components/chart/statistics-chart.ts @@ -347,8 +347,8 @@ class StatisticsChart extends LitElement { statTypes.forEach((type) => { let val: number | null; if (type === "sum") { - if (!initVal) { - initVal = val = stat.state; + if (initVal === null) { + initVal = val = stat.state || 0; prevSum = stat.sum; } else { val = initVal + ((stat.sum || 0) - prevSum!);