Can i remove one label from the bar chart in node red?

hey all.
i am trying to create a horizontal bar chart that display the count of opened tickets in my front end system.

i receive the data from a database, where i run a query to provide me with the count of opened events and i group them based on the event types, hence my bar chart should display the type of the events and the count of each type.

the chart works well when i add a new type (label) along with its data, and works well when the number of count is updated, however i am facing an issue when label does not have any counts (the query in the database does not return the type since the count of it is zero) and the bar chart keeps on showing the last value of this type, it does not remove it nor change the count to 0.

is there is a way to solve this by making the bar chart only show what payload i provide to it?

i tried to send a empty array before updating but this looks really unprofessional because the chart keep on jittering with every update.

thanks in advance.

P.S.: i am not able to share my flow as its confidential.

There is no need to share the real flow. Just create a simple test flow showing the problem. Use a few inject nodes to simulate the issue, feeding a chart node. Paste it here and tell us what order to click the injects to see the problem.

1 Like

Sorry for the delay in reply, i have took your advice and tested it with inject payloads and turns out that the payload that i receive from the database has a different structure so its not deleting the old entries when they are not found in the payload, i have split my payload and performed changes on it so i can get the final payload which is accepted by the chart and now its working perfectly.

1 Like