Changing line thickness in ui_chart

What is the correct way to use msg.ui_control to change the line thickness in a ui_chart? I've seen this post, and example by @hotNipi -

and I'm adding msg.ui_control in the function which formats the chart data, a simplified extract would be;

msg.payload = chartdata;
msg.topic = 'status';
msg.ui_control = {
    "options": {
        "elements": {
            "line": {
                "borderWidth": 1
            }
        }
    }
}

...which changes the chart unexpectedly!

chart

By changing the line options, most of related things fall back to library default.
So it takes to adjust those things.
Assuming you don't want the fill and points

msg.ui_control = {
    "options": {
        "elements": {
            "line": {
                "borderWidth": 1,
                "fill":false
            },
            "point":{
                "radius":0
            }
        }
    }
}
1 Like

Aah OK, I did read the chart.js documentation and expected those options to return to default unless specified otherwise.
But it works fine now, thanks.
Much better with a 1px line width :blush:

chart

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