# Synchronising Y axis autoscale on 2 chart nodes

**URL:** <https://discourse.nodered.org/t/synchronising-y-axis-autoscale-on-2-chart-nodes/84771>\
**Category:** Dashboard\
**Created:** [21 January 2024 10:56 UTC](https://discourse.nodered.org/t/synchronising-y-axis-autoscale-on-2-chart-nodes/84771 "2024-01-21T10:56:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![NPT](https://avatars.discourse-cdn.com/v4/letter/n/9de053/32.png) [@NPT](https://discourse.nodered.org/u/NPT)\
**Post date:** [21 January 2024 10:56 UTC](https://discourse.nodered.org/t/synchronising-y-axis-autoscale-on-2-chart-nodes/84771/1 "2024-01-21T10:56:36Z")

</div>

I have 2 chart nodes displaying temperatures from 2 separate sensors side by side. In both nodes the Y axis Max & Min properties are left intentionally blank so that the charts auto-scale. However, even a few degrees difference between the Max/Min ranges will obviously make the scales vary and this introduces a degree of confusion when glancing at the screen.

Is it possible to synchronise the 2 chart nodes auto-scale, so that the Y axis Max & Min appear the same on both?

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [21 January 2024 13:06 UTC](https://discourse.nodered.org/t/synchronising-y-axis-autoscale-on-2-chart-nodes/84771/2 "2024-01-21T13:06:48Z")

</div>

Here's an example of suggested min max  
For chart. It takes to send same information for both charts but as it will be overwritten whenever min or max will go over boundaries you should figure out some logic to update chart configs when needed.

> [@Chart Node Auto-Scaling](https://discourse.nodered.org/t/chart-node-auto-scaling/84450):
>
> By default the chart will auto-scale on the Y axis. Or I can specify axes values with msg.ui\_control = { "ymax": (scale\_max), "ymin": (scale\_min), "stepSize": '0.5' }; I'm trying to prevent a chart Y axis being too 'short'. Ideally there would be a 'minimum range' value for the Y axis, but absent being able to set that I need to ensure that ymax less ymin is not less than say, 10. I have a function node to do this, but I'd like to be able to revert. to auto-scaling with the logic If maximu…

---

<div class="post-metadata">

**Author:** ![NPT](https://avatars.discourse-cdn.com/v4/letter/n/9de053/32.png) [@NPT](https://discourse.nodered.org/u/NPT)\
**Post date:** [21 January 2024 14:15 UTC](https://discourse.nodered.org/t/synchronising-y-axis-autoscale-on-2-chart-nodes/84771/3 "2024-01-21T14:15:26Z")

</div>

Many thanks for that - it points me in the right direction.

I had wondered if YMax and Ymin values were available from the node when autoscaling. I could then take the larger of the Max and smaller of the Min and set them both accordingly but that could end up in a messy perpetually-correcting loop.

I shall knock up a quick function node and feed it with the two incoming values and write a comparator to determine range and scale both chart nodes accordingly.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [20 February 2024 14:16 UTC](https://discourse.nodered.org/t/synchronising-y-axis-autoscale-on-2-chart-nodes/84771/4 "2024-02-20T14:16:26Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
