Comments (3)
Uhm. This is a bit trickier that what I thought: the duration specified is internally converted to milliseconds. Later in the code, I don't really know if you wrote 1w or 7d or 168h.
This means that it is not quite clear where to reset. For example
- every 30 days from the beginning of the year
vs
every 1st day of the month - every 7 days starting the beginning of the month
vs
the a Mondayvs
beginning of year - ...
I think the most intuitive behaviour is to use a specific parsing algorithm for this use case where the unit is kept, decimals are not allowed(i.e you can't do 1.5 weeks)
- if the unit is years -> start on 1st of Jan
- if months -> start on 1st of Jan and add calendar months
- If weeks -> start on a Monday and add whole weeks
- if days, hours, mins, secs, ms -> start at midnight
Do you see any corner case with this approach?
from lovelace-plotly-graph-card.
I would agree no decimals, if you reset every 1.5 days, what is your start day? Which days get cut in half? Too much ambiguity.
Every month resets on the 1st of each month (is that possible? I know in the yaml if you specify 1M, it really translates to 30 days, not exactly a month depending on which month we're in. If you start it on Jan 1st, it'll be off all year since Jan is 31 days. And after 12 months (365 days) you're off by 5 days.)
Every week restarts on each Monday in my world. But I know there are a lot of Sunday fanatics as well (I don't think HA has a "first day of week" setting. At least I couldn't find one just now. You may be able to pull that out of the OS? (Though not sure if that's exposed)). So the every week one could be an issue here and there depending on localization.
from lovelace-plotly-graph-card.
HA does allow changing the first day of the week. To do it, click on your name on the left side bar. This card uses that to configure what "current_week" means :)
Resetting on the 1st is indeed possible, I'll need to "remember" the unit used and work with the actual calendar dates instead of bare milliseconds.
I think it will work
from lovelace-plotly-graph-card.
Related Issues (20)
- Can't plot certain measurements with statistics enabled
- Incorrect aggregated (1d) results HOT 21
- Issue with "autorange_after_scroll" when using an arbitrary function
- Hover Box on Mobile Using Touch Input HOT 3
- customdata.name not properly replaced in hovertemplate HOT 9
- jumping legend (browser issue or configured something wrong?) HOT 2
- Ecobee Data Issue HOT 1
- Error if HA port is changed from 8123 HOT 14
- Color Threshold or Color Scale in chart HOT 1
- Data not being updated on real time HOT 16
- Display times with HA selected timezone?
- Gaps in data when scrolling HOT 16
- Non null flat line joining when no data HOT 23
- Pie chart not working HOT 3
- URL duplicated in the `no_default_layout` deprecation message HOT 3
- Add a "year" grouping option in period
- Edition window moves under Safari
- Add notation points along realtime graph.
- Range of data not updating when zooming out HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lovelace-plotly-graph-card.