Skip to content

Commit 68702c5

Browse files
committed
Change auto period resolution to 100
1 parent d638b46 commit 68702c5

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/plotly-graph-card.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,16 +307,15 @@ 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 = 500;
310+
const MIN_POINTS_PER_RANGE = 100;
311+
let period: StatisticPeriod = "5minute";
311312
const period2minutes: [StatisticPeriod, number][] = [
312313
// needs to be sorted in ascending order
313-
["5minute", 5],
314314
["hour", 60],
315315
["day", 60 * 24],
316316
// ["week", 60 * 24 * 7], not supported yet in HA
317317
["month", 60 * 24 * 30],
318318
];
319-
let period = period2minutes[0][0];
320319
for (const [aPeriod, minutesPerPoint] of period2minutes) {
321320
const pointsInSpan = spanInMinutes / minutesPerPoint;
322321
if (pointsInSpan > MIN_POINTS_PER_RANGE) period = aPeriod;

0 commit comments

Comments
 (0)