Zoom limits #233
dbuezas
started this conversation in
Show and tell
Zoom limits
#233
Replies: 1 comment 1 reply
-
Here is how you automatically re-scale just visible area - min is set to 0, max to max value in the visible area: uirevision: $fn ({ getFromConfig }) => getFromConfig('visible_range')[0] // force rescale on scroll only - not when visible entities change or new data point is added
range: |
$fn ({ getFromConfig }) => {
const date_from = new Date(getFromConfig('visible_range')[0]);
const date_to = new Date(getFromConfig('visible_range')[1]);
const all = getFromConfig("entities").flatMap(({ x, y }) => x.map((xi, i) => [xi, y[i]]).filter(([d, v]) => d >= date_from && d <= date_to).map(([d, v]) => v));
return [0, Math.max(...all)]
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Proposed by @Rvh91 and originally tracked in #60, it is now possible to implement in yaml by the user (through $fn).
In this example, the y axis is dynamically limited to the visible range of the entities, and further constrained to be between 12 to 18
Beta Was this translation helpful? Give feedback.
All reactions