Chart Node Auto-Scaling

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 maximum_value - minimum_value < 10
Set axis values with function node
Set axis values to auto-scale

So how do I return a chart to auto-scale the Y axis after using 'msg.ui_control', please?

1 Like

Am I correct in understanding that if I use

msg.ui_control = { "suggestedMax": scale_max, "suggestedMin": scale_min };

That this will allow auto-scaling to continue to function?

I can't get this to work!

Chart of 24 hour temperature ...

I am sending
msg.ui_control = {"suggestedMax":scale_max,"suggestedMin":scale_min};

where scale_max = 7 and scale_min = 2

But the chart is auto-scaling from 0 to 6.

I thought that scale minimum would be "Math.min(dataMin, suggestedMin)" and that scale maximum would be "Math.max(dataMax, suggestedMax)" but clearly I'm missing something about how this is supposed to work.

With function node:

msg.ui_control = {
        scales: {
            yAxes: [
                ticks: {
                        suggestedMin: 50,
                        suggestedMax: 100

delete msg.payload;
return msg;

I was searching Github to try to find that. Many thanks.

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