dbuezas / lovelace-plotly-graph-card

Highly customisable Lovelace card to plot interactive graphs. Brings scrolling, zooming, and much more!
411 stars 20 forks source link

More period options #448

Closed smeingast closed 2 months ago

smeingast commented 2 months ago

Describe the solution you'd like

Currently, there are six period options implemented: 5minute, hour, day, week, month, auto. However, the steps between these are uneven and large so that for given displayed time periods there is no optimum. For instance, going from 5 minutes to 1 hour is a factor of 12, from hour to day is a factor of 24, then a factor of 7 from day to week, and a factor of about 4.5 from week to month.

In order to have smaller steps, I propose to add more options, such as '10minute', '30minute', '2hour', '6hour', '12hour', '3day', '2week'.

How would it be defined in yaml? By adding more options to the currently available ones.

dbuezas commented 2 months ago

These are not in my control, home assistant stores long term statistics in the db and its API offers only those granularities. That's why the native statistics card offers exactly the same period options too (https://www.home-assistant.io/dashboards/statistics-graph#period)

The only thing that could be done is to fetch the hourly period and then resample locally, which can be done with the resample filter

dbuezas commented 2 months ago

I forgot my manners, thanks for reaching out with improvement ideas :)

smeingast commented 2 months ago

No worries at all, and thank you for your quick response! I'll definitely look into the resampling option. Thanks again!