Yes, I have read that.
Alas "something" isn't jelling with me.
(This is going to be slightly annoying, but please indulge me.)
This works - from Nick.
[{"id":"69d670b1.8e8b3","type":"inject","z":"6472f474.da7424","name":"MusicPi","topic":"","payload":"/home/me/TEMP/Data/musicpi_temp.db","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":440,"wires":[["e2ef7cb.a26c48"]]},{"id":"e2ef7cb.a26c48","type":"function","z":"6472f474.da7424","name":"Set filename","func":"msg.filename = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":440,"wires":[["3512b71a.f19f78"]]},{"id":"3512b71a.f19f78","type":"file in","z":"6472f474.da7424","name":"Read file","filename":"","format":"lines","chunk":false,"sendError":false,"x":540,"y":440,"wires":[["fd27b39.50ba75"]]},{"id":"fd27b39.50ba75","type":"function","z":"6472f474.da7424","name":"","func":"var parts = msg.payload.split(/ - /).map(function(v) { return parseInt(v)});\nmsg.payload = {x:parts[0], y:parts[1]};\nreturn msg;\n","outputs":1,"noerr":0,"x":190,"y":510,"wires":[["6bf71402.79b2bc"]]},{"id":"6bf71402.79b2bc","type":"join","z":"6472f474.da7424","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":320,"y":510,"wires":[["bd1d2642.b76e98"]]},{"id":"bd1d2642.b76e98","type":"function","z":"6472f474.da7424","name":"Format message for chart","func":"msg.payload = [{\n \"series\": [\"B\"],\n \"data\": [msg.payload],\n \"labels\": [\"\"]\n}];\nmsg.topic = \"Data set 2\";\nreturn msg;","outputs":1,"noerr":0,"x":540,"y":510,"wires":[["57ec8591.403c3c","6397865d.a94918"]]},{"id":"6397865d.a94918","type":"ui_chart","z":"6472f474.da7424","name":"","group":"f25bb428.e9272","order":0,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"N/C","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"200","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":930,"y":340,"wires":[[],[]]},{"id":"f25bb428.e9272","type":"ui_group","z":"","name":"Graph","tab":"91f90dd2.4c30b8","order":1,"disp":true,"width":"10","collapse":false},{"id":"91f90dd2.4c30b8","type":"ui_tab","z":"","name":"Charts","icon":"dashboard","order":19}]
From there I built this to "prove" the concept of how to have 2 sets of data on one graph.
[{"id":"69d670b1.8e8b3","type":"inject","z":"6472f474.da7424","name":"MusicPi","topic":"","payload":"/home/me/TEMP/Data/musicpi_temp.db","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":440,"wires":[["e2ef7cb.a26c48"]]},{"id":"e2ef7cb.a26c48","type":"function","z":"6472f474.da7424","name":"Set filename","func":"msg.filename = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":440,"wires":[["3512b71a.f19f78"]]},{"id":"3512b71a.f19f78","type":"file in","z":"6472f474.da7424","name":"Read file","filename":"","format":"lines","chunk":false,"sendError":false,"x":540,"y":440,"wires":[["fd27b39.50ba75"]]},{"id":"fd27b39.50ba75","type":"function","z":"6472f474.da7424","name":"","func":"var parts = msg.payload.split(/ - /).map(function(v) { return parseInt(v)});\nmsg.payload = {x:parts[0], y:parts[1]};\nreturn msg;\n","outputs":1,"noerr":0,"x":190,"y":510,"wires":[["6bf71402.79b2bc"]]},{"id":"6bf71402.79b2bc","type":"join","z":"6472f474.da7424","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":320,"y":510,"wires":[["bd1d2642.b76e98"]]},{"id":"bd1d2642.b76e98","type":"function","z":"6472f474.da7424","name":"Format message for chart","func":"msg.payload = [{\n \"series\": [\"B\"],\n \"data\": [msg.payload],\n \"labels\": [\"\"]\n}];\nmsg.topic = \"Data set 2\";\nreturn msg;","outputs":1,"noerr":0,"x":540,"y":510,"wires":[["57ec8591.403c3c","6397865d.a94918"]]},{"id":"6397865d.a94918","type":"ui_chart","z":"6472f474.da7424","name":"","group":"f25bb428.e9272","order":0,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"N/C","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"200","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":930,"y":340,"wires":[[],[]]},{"id":"f25bb428.e9272","type":"ui_group","z":"","name":"Graph","tab":"91f90dd2.4c30b8","order":1,"disp":true,"width":"10","collapse":false},{"id":"91f90dd2.4c30b8","type":"ui_tab","z":"","name":"Charts","icon":"dashboard","order":19}]
Now, I know it is a poor representation, but it works.
I get two different colour lines on the graph. The delay is there only because ..... I wanted to make sure it was the OTHER data being shown.
The packets coming out of the two nodes look like this:
{"payload":89,"topic":"Line 1","_msgid":"eee576b9.45dc58"}
{"topic":"Line 2","payload":96,"_msgid":"eee576b9.45dc58"}
Which kind of concurs with what is said on the link.
So-o-o.....
If that works, it has TOPIC to distinguish between the data set it is showing on the chart.
That led me to the next stage:
Rather than having multiple databases, what would happen if I had ONE database and each line had an identifier which can be used to tell it which set of data it belongs to?
So I made this to generate a bit of pseudo random data from two devices.
[{"id":"8b87e02a.66542","type":"inject","z":"6472f474.da7424","name":"","topic":"","payload":"","payloadType":"date","repeat":"3","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":2370,"wires":[["456dfcaf.4a274c"]]},{"id":"456dfcaf.4a274c","type":"traffic","z":"6472f474.da7424","name":"","property_allow":"payload","filter_allow":"GO","ignore_case_allow":false,"negate_allow":false,"send_allow":false,"property_stop":"payload","filter_stop":"STOP","ignore_case_stop":false,"negate_stop":false,"send_stop":false,"default_start":false,"differ":false,"x":340,"y":2370,"wires":[["974e1c8e.b37a1"]]},{"id":"b4acbbc5.35a89","type":"inject","z":"6472f474.da7424","name":"","topic":"","payload":"GO","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":2260,"wires":[["456dfcaf.4a274c"]]},{"id":"c65da2a0.13dc58","type":"inject","z":"6472f474.da7424","name":"","topic":"","payload":"STOP","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":2300,"wires":[["456dfcaf.4a274c"]]},{"id":"aeecff59.e1095","type":"function","z":"6472f474.da7424","name":"","func":"msg.filename = \"/home/me/TEMP/random_data.db\";\nvar time = Date.now();\nvar x = msg.payload;\nmsg.payload = time + ' - ' + x + ' - ' + '1';\n//msg.topic = \"Data flow 1\";\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":2370,"wires":[["c44407bc.a6691"]]},{"id":"3815dffc.7b14a","type":"function","z":"6472f474.da7424","name":"","func":"msg.filename = \"/home/me/TEMP/random_data.db\";\nvar time = Date.now();\nvar x = msg.payload;\nmsg.payload = time + ' - ' + x + ' - ' + '2';\n//msg.topic = \"Data flow 2\";\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":2570,"wires":[["c44407bc.a6691"]]},{"id":"5bc909ac.938fc","type":"inject","z":"6472f474.da7424","name":"","topic":"","payload":"","payloadType":"date","repeat":"3","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":2570,"wires":[["2240ec30.2b0a3c"]]},{"id":"2240ec30.2b0a3c","type":"traffic","z":"6472f474.da7424","name":"","property_allow":"payload","filter_allow":"GO","ignore_case_allow":false,"negate_allow":false,"send_allow":false,"property_stop":"payload","filter_stop":"STOP","ignore_case_stop":false,"negate_stop":false,"send_stop":false,"default_start":false,"differ":false,"x":340,"y":2570,"wires":[["b5c920ae.c2d5"]]},{"id":"2e5a5c30.212324","type":"inject","z":"6472f474.da7424","name":"","topic":"","payload":"GO","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":2460,"wires":[["2240ec30.2b0a3c"]]},{"id":"1764df6b.288779","type":"inject","z":"6472f474.da7424","name":"","topic":"","payload":"STOP","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":2500,"wires":[["2240ec30.2b0a3c"]]},{"id":"c44407bc.a6691","type":"file","z":"6472f474.da7424","name":"","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"false","x":790,"y":2450,"wires":[]},{"id":"974e1c8e.b37a1","type":"function","z":"6472f474.da7424","name":"","func":"var msg = {};\n//var msg1 = {};\n\nmsg.payload = Math.round(Math.random()*100);\nmsg.topic = \"Line 1\";\n\n//msg1.payload = Math.round(Math.random()*100);\n//msg1.topic = \"Line 2\";\n \nreturn msg;\n","outputs":1,"noerr":0,"x":490,"y":2370,"wires":[["aeecff59.e1095"]]},{"id":"b5c920ae.c2d5","type":"function","z":"6472f474.da7424","name":"","func":"//var msg = {};\nvar msg1 = {};\n\nmsg.payload = Math.round(Math.random()*100);\nmsg.topic = \"Line 2\";\n\n//msg1.payload = Math.round(Math.random()*100);\n//msg1.topic = \"Line 2\";\n\nreturn msg;\n","outputs":1,"noerr":0,"x":490,"y":2570,"wires":[["3815dffc.7b14a"]]}]
That sent out data which seemed to fit with what I have already seen.
But it seems that I can't "intermix" the two sets of data. That is:
dataset 1 must be concurrent as must dataset 2. Not a mishmash of lines.
So that seems to only complicate how I am going to get the (many) data sets from either one big database or many smaller ones and add them all together in one function node and format it to send to the chart.
Because NR is asynchronous, it is still unclear to me how to capture the stored data from multiple files and merge all that to an array, or read in ONE file with a mixture of data sources and format.
P.S.
Sorry, this just in.
To also confuse me, I have this flow:
I have two inject nodes with REAL data in them.
Granted pressing the button again only injects the same data, but if you press both buttons TWICE, you see TWO lines of data on the chart.
Given that, one of my earlier flows SHOULD (by my reasoning) work.
[{"id":"305a6e7f.43d60a","type":"inject","z":"6472f474.da7424","name":"Test1","topic":"","payload":"1532602229265 - 56 - 1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":1100,"wires":[["ef1ce913.5f8e"]]},{"id":"22a0417b.0ec926","type":"inject","z":"6472f474.da7424","name":"Test","topic":"","payload":"1532602223259 - 60 - 2","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":1150,"wires":[["ef1ce913.5f8e","164198bf.bfd2d7"]]},{"id":"ef1ce913.5f8e","type":"split","z":"6472f474.da7424","name":"","splt":"-","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":250,"y":1150,"wires":[["f689827e.ba0108"]]},{"id":"f689827e.ba0108","type":"function","z":"6472f474.da7424","name":"","func":"// var parts = msg.payload.split(/ - /).map(function(v) { return parseInt(v)});\nvar x = msg.payload;\n//msg.payload = parseInt(x);\nmsg.payload = parseInt(x);\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":1150,"wires":[["81e35212.0d0008","39e90f7b.e2052"]]},{"id":"81e35212.0d0008","type":"join","z":"6472f474.da7424","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":510,"y":1150,"wires":[["3af33427.7b587c","5f68eacb.47e034"]]},{"id":"3af33427.7b587c","type":"function","z":"6472f474.da7424","name":"","func":"node.warn(\"msg.payload[0] is\" + msg.payload[0]);\nnode.warn(\"msg.payload[1] is\" + msg.payload[1]);\nnode.warn(\"msg.payload[2] is\" + msg.payload[2]);\nvar value = msg.payload[1];\nvar topic = msg.payload[2];\nmsg.payload = value;\n//msg.payload = [{\n// \"series\": [\"B\"],\n// \"data\": value,\n// \"labels\": [\"\"]\n//}];\nmsg.topic = topic;\nreturn msg;\n","outputs":1,"noerr":0,"x":670,"y":1150,"wires":[["8fdf2e9c.0a5618","65db74d2.6d7004"]]},{"id":"65db74d2.6d7004","type":"ui_chart","z":"6472f474.da7424","name":"","group":"f25bb428.e9272","order":0,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"N/C","dot":false,"ymin":"","ymax":"","removeOlder":"5","removeOlderPoints":"200","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":940,"y":910,"wires":[[],[]]},{"id":"f25bb428.e9272","type":"ui_group","z":"","name":"Graph","tab":"91f90dd2.4c30b8","order":1,"disp":true,"width":"10","collapse":false},{"id":"91f90dd2.4c30b8","type":"ui_tab","z":"","name":"Charts","icon":"dashboard","order":19}]
Seems this is a very bigger cake than I originally thought it was.
I feel I am close, but am missing something - somewhere.