Start with a simple chart that you just feed some fixed data into
(using inject nodes or similar). Once that is working then attempt to
format the data out of the db so that it consists of a sequence of
messages with topic and payload values and feed that into the chart
instead. Ask again when you get stuck.
Colin
The function creates my query and makes it a topic.
I then use a contrib-json to pull one key out of the data...
Then I can direct the key, values to gauges and stuff. I don't know about the charts yet as I'm very new at this and there's probably a better way to do what I'm doing but it's working for me at the moment :)
Good Luck!!
Mark
I meant what it looks like once you get it into node-red.
Colin
The info on the node says "msg.payload can contain an array of values
to bind to the topic." Are you expecting the array you are providing
to be bound to the query?
Colin
On 1 March 2017 at 13:12, Garry Hayne <garry...@gmail.com> wrote:
>
>
> On Saturday, February 25, 2017 at 2:20:54 PM UTC, Colin Law wrote:
>>
>> I meant what it looks like once you get it into node-red.
>>
>> Colin
>>
>>
> Sorry for the delay Colin, the screenshot shows what the data looks like in
> node-red.
>
> Regards, Garry
>
> --
> http://nodered.org
>
> Join us on Slack to continue the conversation: http://nodered.org/slack
> ---
> You received this message because you are subscribed to the Google Groups
> "Node-RED" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to node-red+unsubscribe@googlegroups.com.
> To post to this group, send email to node...@googlegroups.com.
> Visit this group at https://groups.google.com/group/node-red.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/node-red/e38a1f21-de43-442a-9ac5-80684acc95bf%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/MbOPcXNJRzI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send an email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/CAL%3D0gLuMg3wFV0vJ-xP3O2cBRatCRMbzJUCcMZAxznCDedLGRA%40mail.gmail.com.
If you send a few points in real time and attach a debug to the first output of the chart node you will see the current state of the chart object... (which will be an array) - you can copy this format and inject the whole array back into the input to plot your own points from historical data.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/MbOPcXNJRzI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/CACXWFwKSMfv-dTeHEKK-aQtjQ%3DNmaN33OipPMy55Y2HGio3HwQ%40mail.gmail.com.
Yes Dave, I had seen that too, now if I could just work out how to get my data into the same format. My Javascript skills are improving, but a few pointers how to do it would be appreciated if anyone can help. I would have thought that this would be of interest to a lot of people.Garry
On 1 March 2017 at 15:37, Dave C-J <dce...@gmail.com> wrote:
If you send a few points in real time and attach a debug to the first output of the chart node you will see the current state of the chart object... (which will be an array) - you can copy this format and inject the whole array back into the input to plot your own points from historical data.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/MbOPcXNJRzI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.
[ { "time" : "1487079026609", "lat" : "42.3791", "lon" : "-88.0964", "bearing" : "92", "volts" : "13.0", "throttle" : "41.1765", "maf" : "63.55", "coolant" : "92", "rpm" : "1908", "mph" : "74", "vac" : "-3.2420187" }, { "time" : "1488234810064", "lat" : "42.3488", "lon" : "-87.8816", "bearing" : "0", "volts" : "13.3", "throttle" : "18.8235", "maf" : "6.5", "coolant:" "91", "rpm" : "969.25", "mph" : "50", "vac" : "-9.333603" }]
// name of the time column values:var tcol = "time";// list of columns to be charted:var cols = [ "rpm", "mph", "coolant" ];
// iterate over each column of the query resultsvar data = cols.map(function(col) { // iterate over each row of the query results var vals = msg.payload.map(function(row) { // return a data point for each col return [ +row[tcol], +row[col] ]; });
// return data object for each line on the chart return { key: col, values: vals };});
// now put the new chart data in the payloadmsg.payload = data;return msg;
[
{ "key": "rpm", "values": [ [ 1487079026609, 1908 ], [ 1488234810064, 969.25 ] ] }, { "key": "mph", "values": [ [ 1487079026609, 74 ], [ 1488234810064, 50 ] ] }, { "key": "coolant", "values": [ [ 1487079026609, 92 ], [ 1488234810064, 91 ] ] }]
[
{ "key": "rpm", "values": msg.payload.[time, rpm] },
{ "key": "mph", "values": msg.payload.[time, mph] },
{ "key": "coolant", "values": msg.payload.[time, coolant] }
]
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/MbOPcXNJRzI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/3b7111b0-0f1f-45e9-8f12-0552dc040993%40googlegroups.com.
Hi Steve,I can't get it to work at all on my data :(Garry
On Wednesday, March 1, 2017 at 9:06:04 PM UTC, steve rickus wrote:I've wrestled this dragon (jello?) before -- might as well document it here so others can make some use of it...
Day: "2017-01-24T23:58:00.000Z"MaxTmp: 24.6
[
{"Day":Day , "MaxTmp" : MaxTemp}
]
[ {"Key": "MaxTemp", "Values":[ msg.payload.Day, msg.payload.MaxTmp]}]
[ {"Key": "MaxTemp", "Values":[ msg.payload.[Day, MaxTmp]]}]
[ {"Key": "MaxTemp", "Values": msg.payload.[Day, MaxTmp]}]
[ { "field": "MinTmp", "title": "Min. Temp" }, { "field": "MaxTmp", "title": "Max. Temp" }].( $xaxis := "Day"; $yaxis := $.field; $title := $.title; [ { "Key": $title, "Values": $$.[ $lookup($, $xaxis), $lookup($, $yaxis) ] } ])
Jéan,I find the easiest way to debug the jsonata expressions is to use the online JSONata exerciser -- just paste your json structure into the left window, and as you type the expression in the upper right, the results are shown below...
array[63][0 … 9]0: object
Day: "2017-01-24T23:58:00.000Z"MaxTmp: 24.6
1: objectDay: "2017-01-25T23:58:00.000Z"MaxTmp: 30.03
[
{ "field": "MaxTmp", "title": "Max. Temp" }].( $xaxis := "Day"; $yaxis := $.field; $title := $.title; [
{ "Key": $title,
"Values": msg.payload.[ $lookup($, $xaxis), $lookup($, $yaxis) ] } ])
[ {"Key": "MaxTemp", "Values": msg.payload.[Day, MaxTmp]}]
[ {"key": "MaxTemp", "values": msg.payload.[Day, MaxTmp]}]
[ { "key": "MaxTemp", "values": { "series": [ "2017-01-24", "2017-01-25" ], "data": [ [ 24.6, 30.03 ] ] } }]
[ {"key": "Day Litres", "values": { "series": msg.payload.[Day] , "data": [msg.payload.[DayLtrs]] } }]
[ {"key": "Day Litres", "values": { "series": msg.payload.[Day] , "data": msg.payload.[DayLtrs] } }]
'2017/04/17','3.9''2017/04/15','30.5''2017/04/14','176.6'
"[{"key":"Day Litres","values":{"series":["Series-1","Series-1","Series-1","Series-1","Series-1"],"data":[["2016/11/30",188.6],["2016/12/01",296.3],["2016/12/02",104.8],["2016/12/03",321.9],["2016/12/04",287.6]]}}]"
[ {"key": "Day Litres", "values": {
"series": msg.payload.series , "data": [msg.payload.[Day,DayLtrs ]] } }]
[ {
"key": "Day Litres", "values": { "series": [
"2016/11/30", "2016/12/01", "2016/12/02", "2016/12/03", "2016/12/04" ], "data": [ [ 188.6, 296.3, 104.8, 321.9, 287.6 ] ] } }]
[ { "key": "Day Litres", "values": { "series": msg.payload.Day, "data": [ msg.payload.DayLtrs ] } }]
Steve, is it possible to show the incoming SQL, and the jsonata for the graph you are showing below?I tried to use your 2 statements below, in every conceivable way I can think of, to answer to your statements. The best I can get is if I do not have the "Series-1" - but then the graph shows in different colours for every bar, thus it translates every day as a series.Here is my current payload (made readable via the json node, thus "" are added by it)
"[{"key":"Day Litres","values":{"series":["Series-1","Series-1","Series-1","Series-1","Series-1"],"data":[["2016/11/30",188.6],["2016/12/01",296.3],["2016/12/02",104.8],["2016/12/03",321.9],["2016/12/04",287.6]]}}]"
And here is the jsonata for it:
[{ "key": "Day Litres","values": {
"series": msg.payload.Day,"data": [ msg.payload.DayLtrs ]}}]
[ { "key": "Day Litres", "values": { "series": msg.payload.Day, "data": [ msg.payload.DayLtrs ] } }]
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/7592f5d0-68e8-4e23-81f9-ccb4b775397c%40googlegroups.com.
If I understand you you want to see the total water usage for each Monday for the last 40 days and the total water usage for Tuesday for the last 40 days etc. The bottom of the chart will show ‘Monday’, ’Tuesday”, etcIs that correct?If so you need to request the data from MySQL in that format - here is a thread I found using a google search: http://stackoverflow.com/questions/5092706/how-to-count-and-group-items-by-day-of-the-week
On Apr 18, 2017, at 3:59 AM, Jéan Roux <je...@familyroux.com> wrote:
Thank you Steve, the jsonata below delivers the graph below. So at least it spreads it per the correct x-axis. But, it has clearly picked each date as a series, if you do 40 days it is a smarty box. This is not what I want, I want to add a send series to it still, for instance comparing water use for the last 4 weeks, but for the days of the week.--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/7592f5d0-68e8-4e23-81f9-ccb4b775397c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/MbOPcXNJRzI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/8E390C86-E97D-4821-BB63-14C090861ECA%40zenofmud.org.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/CAL09UJN2D3HRRSBxv%2BCw_uc7f9gzRYRx7zikB-aumSpAyHp57A%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/7592f5d0-68e8-4e23-81f9-ccb4b775397c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/MbOPcXNJRzI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/8E390C86-E97D-4821-BB63-14C090861ECA%40zenofmud.org.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/CAL09UJN2D3HRRSBxv%2BCw_uc7f9gzRYRx7zikB-aumSpAyHp57A%40mail.gmail.com.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/MbOPcXNJRzI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/F90B5933-760A-4BAC-833E-44C2723A8E23%40zenofmud.org.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/CAL09UJO%2BT1A%2BrLGhHSfzXk%3Drx3yhGAZMyfagMeR3WK55sopEnQ%40mail.gmail.com.
[ {
"key": "Day Litres", "values": { "series": msg.payload.Day, "data": [ [msg.payload.DayLtrs] ] }
} ]
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/1109567c-2d74-478c-88ae-ec7f74106e43%40googlegroups.com.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/MbOPcXNJRzI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/5c5d40ec-505f-4140-9589-fec4fd412b1f%40googlegroups.com.
When can we see it? Cannot wait to see how you did it !
On 21 April 2017 at 17:46, Csongor Varga <csongo...@gmail.com> wrote:
Hi Guys,Just want to say that I managed to build a dynamic report which supports multiple data series to be displayed in a chart. You can select the data series on the UI, and the time base and the charts gets generated dynamically. There are also buttons on the UI to change the time base, move forward and back in time. I think it is quite neat. I am planning to make a video of it explaining how it works. That can also be adapted for your scenario.Regards,Csongor
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/MbOPcXNJRzI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
I think my problem is that I receive booth messages but with no different topics and this makes the chart to show only the last one data received, any help on how to create a function that provide different topic to each message?
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/MbOPcXNJRzI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/d9a771c2-899c-4202-8d57-b98cdf5a164e%40googlegroups.com.
[
{ "key": "Sensor-1",
"values": [
[1480622344619,22], [1480622945578,20.5], [1480623444808,20], [1480624644810,19.5], [1480625244812,19]
]
},
{
"key": "Sensor-2",
"values": [
[1480622344619,12], [1480622945578,12.5], [1480623444808,12], [1480624644810,13.5], [1480625244812,15]
]
}
]
Can anyone help me a little further?I have learned how to create my chart based on a SQL query, thanks to this entire thread. The only issue that I am having is that my SQL [Timestamp] value is in my table as: 2017-10-02 12:47:59.000... When I look at the debug, I am getting: 1506953921000...My chart is 4 hours behind. How can I fix this.
Thanks,Mike
On Tuesday, July 18, 2017 at 9:06:15 AM UTC-4, Csongor Varga wrote:In my code, when you select multiple points (using the checkboxes), it sends out multiple SQL statements and after the database node, a join node links them all together. You just set the node to create an Array on the output.
On Tuesday, July 18, 2017 at 10:34:29 AM UTC+2, David Caparrós wrote:Any idea on how to combine those 2 arranys on asingle on on a way that chart recognize it?Thanks in advance
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/18ef05a7-fbdc-48a2-8314-5200087d83f8%40googlegroups.com.
On 2 October 2017 at 19:40, Mike Arney <mikespc...@gmail.com> wrote:Can anyone help me a little further?I have learned how to create my chart based on a SQL query, thanks to this entire thread. The only issue that I am having is that my SQL [Timestamp] value is in my table as: 2017-10-02 12:47:59.000... When I look at the debug, I am getting: 1506953921000...My chart is 4 hours behind. How can I fix this.You have said that the value in the table is 017-10-02 12:47:59.000...Is that exactly what you see, complete with dots? What timestamp do you expect to see in the table?The long value you see is probably a millisecond timestamp since time 0 (I forget when that is) so may very well be right. In fact it is likely that the data in the table is actually that long integer and whatever you are using to view it is helpfully changing it into readable form for you.So the question is why is the chart wrong? Would I be right in thinking that your local timezone is UTC+4 (or -4)? If so then the problem is that you are showing or saving it in the wrong zone.It is good practice to save data in a database as UTC, so first check that you are doing this. Then you have to convert it to local time when you add it to the chart.Colin
Thanks,Mike
On Tuesday, July 18, 2017 at 9:06:15 AM UTC-4, Csongor Varga wrote:In my code, when you select multiple points (using the checkboxes), it sends out multiple SQL statements and after the database node, a join node links them all together. You just set the node to create an Array on the output.
On Tuesday, July 18, 2017 at 10:34:29 AM UTC+2, David Caparrós wrote:Any idea on how to combine those 2 arranys on asingle on on a way that chart recognize it?Thanks in advance
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/44561913-4b02-48ba-bbcf-2d71de62a7f3%40googlegroups.com.
Mike,the gauge node expects msg.payload to be a number. So you'll need to use a Change node to move msg.payload[0].AvgTime to msg.payload, before passing it to the gauge node. Also, make sure you've set the min/max range of the gauge node to 0 and 1Nick
On 11 October 2017 at 17:19, Mike Arney <mikespc...@gmail.com> wrote:
How would I have a gauge show this data? I am gathering the average of a value. I need a 0 to 1 gauge. Currently nothing shows.msg.payload : array[1]array[1]0: objectAvgTime: 0.288135Thanks,Mike
On Monday, May 8, 2017 at 4:49:16 AM UTC-4, Dave C-J wrote:Working on some improvements... - https://github.com/node-red/node-red-dashboard/issues/224
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.