Drawing live data

Hello every body how can I draw data in node red chart and gauge from api http link that contained data updated every several seconds .which node red icons used for this scenario

Welcome to the forum @Maf.

Before you start, I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

Then, if you still need help, which part of the requirement do you not know how to do?

Thank you, I'll watch them ,although I draw a figure using node (http request with choose jason parse ,to gauge and chart ,pay load msg ) but the chart and gauge has no data drawn. hint the api link has data like channel of asksensors

After you have watched the videos add debug nodes after each node in your flow and work out where it is going wrong. If you think everything looks right then show us what you are sending to the gauge. Start with the gauge because that is simpler than the chart.

Thanks I'll try .do you mean connect the output or the input of each node in the flow by debug.Can I leave the input of http request without connection

Add the debug nodes where you need them to see where the flow is going wrong.

After you have watched the videos also read carefully the node red docs page Working with Messages.

Thank you for your response
The issue is look like as in this ticket

You need to do some data manipulation before you pass it to a dashboard chart/gauge node. You cannot just pipe data from HTTP response into a dashboard node. It needs to know what to display.

Assuming you are using the chart node with line graph, pass in a single data item and assign a topic for each data entry passed in. For example:

image

The 'topic' for the blue line is 'Air', and a different topic is used for 'Ground' temperature. Check out the 'template' node this will probably do what you are trying to achieve, or use a 'function' node if you know javascript.

One other thing to check if you are trying to extract a datapoint from the JSON is to ensure the data is an object before it reaches the dashboard node; try adding a JSON parser in between the request and chart nodes.

As @Colin points out, make heavy use of 'debug' nodes to check the format of your messages at all stages.

Are you using thingspeak?

It is due to the additional complexity of the chart node that I suggested getting it going with the gauge first.

Gauge operates on a single numeric value, here is one of mine for reference:

msg.payload MUST be an number for this to work, you can see this in the right column.

yes thingspeak

So if you add a debug node after the http request and set the http node up as in the thread you linked (which presumably you have already done) what does the debug node show and what data are you trying to extract?

hello again I learned how the chart and gauge by numeric function , but how can convert the data from HTTP request to numbers for chart or gauge . the data sample
"entry_id":1315,"field4":"1092.00000"},{"created_at":"2021-03-11T22:10:16Z",
"entry_id":1316,"field4":"1091.00000"},{"created_at":"2021-03-11T22:10:32Z",
"entry_id":1317,"field4":"1092.00000"},{"created_at":"2021-03-11T22:10:48Z",
"entry_id":1318,"field4":"1094.00000"},{"created_at":"2021-03-11T22:11:04Z",
"entry_id":1319,"field4":"1092.00000"},{"created_at":"2021-03-11T22:11:20Z",
"entry_id":1320,"field4":"1092.00000"},{"created_at":"2021-03-11T22:11:36Z",
"entry_id":1321,"field4":"1093.00000"},{"created_at":"2021-03-11T22:12:01Z",

If you are in a Function node then, assuming that you have the above data in a javascript array, which is what it looks like, you can use Number(theArray[i].field4) to convert it to a number. Or you can use the Array.map function to convert the whole array in one go. It can also be done in a Change node using JSONata but I will leave that for someone else to tell you how to do it.

I expect googling for
javascript convert string to number
would have found that.
I think the gauge will work with a string value, also I think the chart may be ok with strings for live data but not if you are preloading the chart with existing data. I may be wrong however.

Are you asking a question?
If you are asking how to extract data from the array then first read the node-red docs page Working with Messages which should be helpful. Is the data in the array historical data? If so then what is it that you want to send to the gauge? Usually a gauge is used for showing live data.

In fact both the gauge and (for live data) the chart will accept Strings (containing numbers of course). They don't have to be Number type.

The data each 30 second in array of 100 object as in the flow above how can draw it or take average then draw

This document shows you how you have to arrange the data to use it to fill the chart. node-red-dashboard/Charts.md at master · node-red/node-red-dashboard · GitHub