Clean a chart with a button

I need to reset a chart with a button in node-RED and i didnt know where to start. The buttn has to clear all the data in de chart, any ideas that how i can do that?

Thanks Gabriel

1 Like

As it says in the Info tab for the node “Inputting a msg.payload containing a blank array [] will clear the chart”. So you need to make your button send a message back to node red and on receipt of that send a message to the chart with a payload consisting of an empty array.

1 Like

im starting now with node-red, whats the syntax of an blank array to node-red? thanks for your help and patience

on the msy.payload of the button leave payload on blank like this

image

not worked :frowning:

image

sorry

@davidcgu no, that injects a blank String, not a blank array - it will not work.

@gabrieldicieri To create an Inject node that injects a blank array, select the JSON type and type in [ ]:

That gives you a node you can click on the button within the editor to inject the message with a blank array as the payload.

Or you could use a Function node with the code:

msg.payload =  [];
return msg;

Or you could use a Change node, in a similar fashion to the Inject node:

4 Likes

I completely messed up, right, thanks again Knolleary and sorry for the confusing information I should have checked how I have it done on my flows before answering so happily

Regards.

Problem Solved, you are the guy, thank you so much!