Clean a chart with a button

#1

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

0 Likes

#2

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

#3

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

0 Likes

#4

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

image

0 Likes

#5

not worked :frowning:

0 Likes

#6

image

sorry

0 Likes

#7

@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:

1 Like

#8

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.

0 Likes

#9

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

0 Likes