Data array to payload v.v

Hi guys

tried hours and manny manny searches but I cannot find a way how to.

de array's in chart 1, 2 and 3 arre the same but once trought a msg it's not working.
see de flow below. I cannot get the payload back to an array for the 3d chart.
the format of de payload is the same as the array's from chart 1 and 2.
In the flow below you can test it

[{"id":"2431cf69.efb77","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"6e50a9a6.db3b18","type":"ui_chart","z":"2431cf69.efb77","name":"","group":"8c38a681.5c3c38","order":6,"width":0,"height":0,"label":"bar chart 3","chartType":"bar","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"No Data","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":490,"y":200,"wires":[[],[]]},{"id":"5726c821.796b18","type":"function","z":"2431cf69.efb77","name":"","func":"var test = msg.payload\nvar m={};\nm.labels = [10,20,30,40,50,60,70];\nm.series = ['Series A', 'Series B', 'Series C', 'Series D'];\nm.data = [\n test,\n \n ];\nreturn {payload:[m]};","outputs":1,"noerr":0,"x":310,"y":200,"wires":[["6e50a9a6.db3b18","58933951.d11eb8"]]},{"id":"b93d23e0.ac2bd","type":"ui_button","z":"2431cf69.efb77","name":"","group":"8c38a681.5c3c38","order":5,"width":0,"height":0,"passthru":false,"label":"array3","color":"","bgcolor":"","icon":"","payload":"80, 81, 56, 55, 40","payloadType":"str","topic":"","x":130,"y":200,"wires":[["5726c821.796b18","d9c036cd.654db8"]]},{"id":"733eb6fe.3ae6f8","type":"function","z":"2431cf69.efb77","name":"","func":"var m={};\nm.labels = [10,20,30,40,50,60,70];\nm.series = ['Series A', 'Series B', 'Series C', 'Series D'];\nm.data = [\n [80, 81, 56, 55, 40],\n \n ];\nreturn {payload:[m]};","outputs":1,"noerr":0,"x":310,"y":80,"wires":[["7b4e533.cb4ecac","db321e11.f75f3"]]},{"id":"d9c036cd.654db8","type":"debug","z":"2431cf69.efb77","name":"PAYLOAD ARRAY 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":360,"y":280,"wires":[]},{"id":"7b4e533.cb4ecac","type":"ui_chart","z":"2431cf69.efb77","name":"","group":"8c38a681.5c3c38","order":2,"width":0,"height":0,"label":"bar chart 1","chartType":"bar","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"No Data","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":490,"y":80,"wires":[[],[]]},{"id":"f138f3d8.44011","type":"ui_button","z":"2431cf69.efb77","name":"","group":"8c38a681.5c3c38","order":1,"width":0,"height":0,"passthru":false,"label":"array1","color":"","bgcolor":"","icon":"","payload":"","payloadType":"num","topic":"","x":130,"y":80,"wires":[["733eb6fe.3ae6f8"]]},{"id":"df4feb63.1e1468","type":"ui_chart","z":"2431cf69.efb77","name":"","group":"8c38a681.5c3c38","order":4,"width":0,"height":0,"label":"bar chart 2","chartType":"bar","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"No Data","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":490,"y":140,"wires":[[],[]]},{"id":"dec1f358.7f744","type":"function","z":"2431cf69.efb77","name":"","func":"var test = [80, 81, 56, 55, 40];\nvar m={};\nm.labels = [10,20,30,40,50,60,70];\nm.series = ['Series A', 'Series B', 'Series C', 'Series D'];\nm.data = [\n test,\n \n ];\nreturn {payload:[m]};","outputs":1,"noerr":0,"x":310,"y":140,"wires":[["df4feb63.1e1468","742afa5.168db04"]]},{"id":"e89f8627.20c478","type":"ui_button","z":"2431cf69.efb77","name":"","group":"8c38a681.5c3c38","order":3,"width":0,"height":0,"passthru":false,"label":"array2","color":"","bgcolor":"","icon":"","payload":"","payloadType":"num","topic":"","x":130,"y":140,"wires":[["dec1f358.7f744"]]},{"id":"db321e11.f75f3","type":"debug","z":"2431cf69.efb77","name":"ARRAY 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":680,"y":100,"wires":[]},{"id":"742afa5.168db04","type":"debug","z":"2431cf69.efb77","name":"ARRAY 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":680,"y":160,"wires":[]},{"id":"58933951.d11eb8","type":"debug","z":"2431cf69.efb77","name":"ARRAY 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":680,"y":220,"wires":[]},{"id":"8c38a681.5c3c38","type":"ui_group","z":"","name":"bar chart","tab":"e02ec498.531178","order":1,"disp":true,"width":"6","collapse":false},{"id":"e02ec498.531178","type":"ui_tab","name":"Tab 7","icon":"dashboard","order":7}]

TNX

Mark

Your third function node, takes in a string "80, 81, 56, 55, 40"

var test = msg.payload
var m={};
m.labels = [10,20,30,40,50,60,70];
m.series = ['Series A', 'Series B', 'Series C', 'Series D'];
m.data = [
 test,
 
 ];
return {payload:[m]};

This ends up with the following NRarraystring

Which hopefully you can see is not the same as the data from chart1 (also in image).

What you will need to do is convert the string to an array before feeding it to your chart.
You can't do that by just sticking it between square brackets.

You can do this by changing the first line of your third function to:
var test = JSON.parse("[" + msg.payload + "]");

Hi Ukmoose,

Perfect it works. Now I tried to find this..

googled for. "javascript convert string to an array" yep....

I just didn't know the words to look for....

TNX