Is there a way to retrieve the visible range of the current Y axis? #504
Unanswered
deltamelter
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Yes, you can get the visible x range with entities:
- entity : sensor.xyz
filters:
- filter: |
x >= get('visible_range')[0] && x <= get('visible_range')[1]
fn: |
$ex {
vars.y_range = [
ys.reduce((y, acc)=> Math.min(y, acc),Number.POSITIVE_INFINITY),
ys.reduce((y, acc)=> Math.max(y, acc),Number.NEGATIVE_INFINITY)
]
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Mainly looking at methods to adjust Y zoom so that the Y axis range is limited to what is actually within visibility for the current X range..
For example, there was an extreme high several days ago, but the Y-axis range auto scaling keeps the Y-Range to include that high, leaving more than half of the chart empty when looking at just today.
default view of the chart is forward looking (the y-range looking at everything past and future):
It would also be useful when drawing time related shapes and variable width bars representing timed events to set the "height" to a reasonable value within the currently visible range. instead of simply blocking out y: 0 to some arbitrary number that might be too big or small to see in context of the other data in the same Yaxis.
Beta Was this translation helpful? Give feedback.
All reactions