From b1d3ab0e5c898ecf2f7b418812125d6680243353 Mon Sep 17 00:00:00 2001 From: David Buezas Date: Sun, 13 Nov 2022 20:48:03 +0100 Subject: [PATCH] Fix period: auto --- src/plotly-graph-card.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/plotly-graph-card.ts b/src/plotly-graph-card.ts index 24a0a6a..ed9e768 100644 --- a/src/plotly-graph-card.ts +++ b/src/plotly-graph-card.ts @@ -268,7 +268,6 @@ export class PlotlyGraph extends HTMLElement { return [start, end + msPad]; } getVisibleRange() { - console.log(this.contentEl.layout.xaxis!.range); return this.contentEl.layout.xaxis!.range!.map((date) => { // if autoscale is used after scrolling, plotly returns the dates as timestamps (numbers) instead of iso strings if (Number.isFinite(date)) return date; @@ -400,13 +399,12 @@ export class PlotlyGraph extends HTMLElement { // @TODO: cleanup how this is done if (entity.period === "auto") { entity.period = { - "0": "5minute", + "0s": "5minute", "1d": "hour", "7d": "day", - // "28d": "week", + "28d": "week", "12M": "month", }; - entity.period = undefined; } if (getIsPureObject(entity.period)) { entity.autoPeriod = entity.period;