I'm facing a challenge while trying to display a real-time graph based on data retrieved from an MQTT node in Node-RED. My approach involves reading data from the MQTT node and transforming it into the appropriate format. However, despite my efforts, I'm unable to visualize a functional graph. It seems that I might be missing something in my approach.
Here's a snippet of the code I'm currently using in the function node:
Regardless of that, the format you are trying to assemble with series, data and labels arrays is for stored data and I believe that when you send data in that form, the chart node will redraw with a clean sheet. If there's only one data point you don't get any lines on the chart.
Sorry, multiple edits to adjust what my phone thinks I should be saying.
Do you mean each sample is sent to MQTT when the button is pressed? Or is a complete sequence sent when the button is pressed?
If it is a complete sequence then the ideal would be to change the sender so that it sends the whole set as an array instead of a sequence of separate samples.