-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: programmable y axis limits #60
Comments
Yes, I really wish plotly had that option. One workaround is for me to update the ranges AFTER the user interaction, which will make the UI very jumpy |
I suppose that universal functions can handle at least a big part of this, provided one can disable the autoscaling feature. |
I haven't tried it yet, but i think so, yes. Using vars or getFromConfig. If you try it please let me know how it went! |
I couldn't resist: type: custom:plotly-graph-dev
hours_to_show: current_week
entities:
- entity: sensor.senseair_temperature
- entity: sensor.durchgang_thermometer_temperature
layout:
uirevision: $fn () => Math.random() // force rescale on scroll
yaxis:
range: |
$fn ({ getFromConfig }) => {
const all = getFromConfig("entities").flatMap(({ y }) => y);
return [
Math.max(12, Math.min(...all)), // cap to lowest value, but at least 12
Math.min(18, Math.max(...all)), // cap to highest value, but at most 18
]
} This only works if you use a single yaxis. You can also:
I tried this and it works, but the code gets too contrived to serve as an example. |
This looks great! it is exactly what i meant! I'll have to play around with the code you shared a bit to understand the syntax a bit better, but great work regardless! I'm surprised by how fast you axii update btw. is this recorded from a dashboard in homeassistant? For me if i increase the timespan of the plot to more then a day (from lets say my default 2 hours) , for sure i'm waiting much longer (eg. 20-30s) before the graph is 'populated' on the new part of the time range. did you do anything clever with that? or should i just sample less often? (i now sample temperatures every 2mins) |
Happy to hear! and even more happy that the universal functions cover this so nicely. I didn't have this in mind so good that @FrnchFrgg mentioned it.
yes, that's just too much data. (and I have a fast computer) |
Transferred to discussion #233 |
Been playing around with the statistics, speeds up the rendering significantly! thanks for the suggestion. It seems however as if the 'auto' period setting doesn't really use 100 data points (or are they shared between all entities?) When switching to a 7 day period, I get a very coarse trace (see below). Is this the expected behavior? for the following yaml:
|
Oh, you are right, I changed it a while back and it seems I forgot to update the readme. I'll fix the default behavior in the next release.
|
V3.3.0 has the corrected defaults for the auto period, minimum 100 datapoints at each level :) |
Also, I see you are using the range selector. You may be interested in the custom one linked in the readme ( in the range selector section) it can also scroll and it is animated |
Thanks! I have noticed it working now. I'm a bit confused now by the documentation however.
compared with this one which has a bit more comments:
Am I right to assume that anywhere in between 100h and 99d, the statistics for 'day' wil be used. So actually in that case we would have 2376 samples rather than the 100 datapoints? also, I initially though that this integration was computing the statistics, but from this it appears to me that plotly doesn't compute the statistics, but rather takes this from the HA recorder (which maybe only tracks statistics for the given periods (hour, day, week, month etc.)). Is that correct? |
That's correct 👍
almost. The statistic for In that case you can just say: |
Yes that was what I was using, I just wanted to understand what was happening. I now understand why it does not take exactly 100 samples in that default scenario, which is what I was expecting. I think my confusion was caused by the misunderstanding of how the statistics where 'computed'. Thanks for the great support by the way! |
fyi added rescaling to just visible area as comment in #233 |
It would be great if we could change the autoscale behavior. For example one of the following (or all) would be nice:
The text was updated successfully, but these errors were encountered: