Skip to content

Commit 9a7aa95

Browse files
committed
Fix statistics set to auto period
1 parent bb4af53 commit 9a7aa95

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/plotly-graph-card.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ export class PlotlyGraph extends HTMLElement {
237237
const validStatistic = STATISTIC_TYPES.includes(entity.statistic!);
238238
if (!validStatistic) entity.statistic = "mean";
239239
const validPeriod = STATISTIC_PERIODS.includes(entity.period);
240-
if ((entity.period = "auto")) {
240+
if (entity.period === "auto") {
241241
entity.autoPeriod = true;
242242
}
243243
if (!validPeriod) entity.period = "hour";
@@ -307,7 +307,7 @@ export class PlotlyGraph extends HTMLElement {
307307
if ((entity as any).autoPeriod) {
308308
if (isEntityIdStatisticsConfig(entity) && entity.autoPeriod) {
309309
const spanInMinutes = (range[1] - range[0]) / 1000 / 60;
310-
const MIN_POINTS_PER_RANGE = 10;
310+
const MIN_POINTS_PER_RANGE = 500;
311311
const period2minutes: [StatisticPeriod, number][] = [
312312
// needs to be sorted in ascending order
313313
["5minute", 5],

0 commit comments

Comments
 (0)