From e5840fb60c1121a237daa189453e2cb1d3bb22f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Wiedemann?= Date: Sat, 6 Mar 2021 12:15:57 +0000 Subject: [PATCH] fix: Chart not displayed properly or at all with layout-card Fixes #121 --- src/apexcharts-card.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/apexcharts-card.ts b/src/apexcharts-card.ts index acccfa1..7f441e8 100644 --- a/src/apexcharts-card.ts +++ b/src/apexcharts-card.ts @@ -595,7 +595,11 @@ class ChartsCard extends LitElement { if (!this._config?.series[index].show.in_chart && !this._config?.series[index].show.in_brush) { return; } - if (graph.history.length === 0) return [{ data: [] }]; + if (graph.history.length === 0) { + if (this._config?.series[index].show.in_chart) graphData.series.push({ data: [] }); + if (this._config?.series[index].show.in_brush) brushData.series.push({ data: [] }); + return; + } let data: EntityCachePoints = []; if (this._config?.series[index].extend_to_end && this._config?.series[index].type !== 'column') { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion