Ui_control parameters for a line plot

I am trying to modify a simple line plot with the msg.ui_control variable.
However I am not sure which parameters are allowed.

  1. If I follow the table here I got basically the same parameters as in the ui_chart widget itself.
  2. If I try some more extended setting parameters according to the chartjs documentation most of the settings there are not working. for example a function like this:
msg.payload = [{"series": series, "data": jsondata, "labels": labels}];  
msg.ui_control = {
    options: {
    scales: {
        yAxes: {
            ticks: { max: 10 }
            }
        }
    }
}
msg.ui_control.options.scales.yAxes.ticks.min = 0;

return msg;

shows an empty plot when used as an input to a ui_chart node. Are the chart.js parameters not valid here?

HI!

I'm using that as well, see:

Try using strings in your object

Thanks for the hint! I placed the keywords in quotes (which should be obsolete for a JSON string) and now the plot reappears with the default axes ticks. Looks like the complete msg.ui_control is ignored.. :roll_eyes:

The yAxes in your first post should be an array, see here Cartesian · Chart.js documentation

Edit: I tried with your code above (array "[...]" added), and it doesn't work. To make it work I had to add some x axis configuration

            xAxes: [{
                type: 'time',
            }],

That worked

1 Like

You are a hero :grinning: Indeed this works. Apparently you need a complete description of all axes.

Thanks a lot!

You're welcome :smiley:

In my case I only cusomize my x-axis. So it seems you can modify your x-axis without using the y-axis, but you cannot modify the y-axis without the x-axis. Maybe - in contrast to my example above - an empty object is enough? I didn't test it...

It might test a little further but for now I am happy to have a line plot which displays correctly (and controlled) on my 8y old iPad as well as my latest PC. Not trivial considering all the issues with javasscript framework versions..

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