Hello All!
I'm trying to create a graph from a CSV file below is the flow I have:
The CSV is very simple, one column with time and 6 columns with data. However, I'm not able to display anything in the graph. What I'm doing wrong? Thank you so much.
CSV sample data:
TIME,IA,IB,IC,VA,VB,VC
09:21.3,-3.984,2.188,1.563,-0.165,0.105,0.057
09:21.3,-3.984,1.406,2.266,-0.169,0.077,0.089
09:21.3,-3.75,0.703,2.734,-0.161,0.045,0.111
[
{
"id": "ececab80965a5f13",
"type": "tab",
"label": "graph csv",
"disabled": false,
"info": ""
},
{
"id": "5e2714570cd93537",
"type": "inject",
"z": "ececab80965a5f13",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "start",
"payload": "1",
"payloadType": "num",
"x": 150,
"y": 80,
"wires": [
[
"92d76645c7b27a3a"
]
]
},
{
"id": "f62c08cb2bed5705",
"type": "debug",
"z": "ececab80965a5f13",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 770,
"y": 160,
"wires": []
},
{
"id": "92d76645c7b27a3a",
"type": "file in",
"z": "ececab80965a5f13",
"name": "",
"filename": "C:\\Users\\user\\Documents\\yesid1.csv",
"format": "utf8",
"chunk": false,
"sendError": false,
"encoding": "none",
"allProps": false,
"x": 330,
"y": 160,
"wires": [
[
"3c839915820df949",
"f62c08cb2bed5705"
]
]
},
{
"id": "3c839915820df949",
"type": "csv",
"z": "ececab80965a5f13",
"name": "",
"sep": ",",
"hdrin": true,
"hdrout": "",
"multi": "mult",
"ret": "\\n",
"temp": "",
"skip": "0",
"strings": true,
"include_empty_strings": false,
"include_null_values": false,
"x": 310,
"y": 280,
"wires": [
[
"88f2e89168793a99",
"f62c08cb2bed5705"
]
]
},
{
"id": "88f2e89168793a99",
"type": "function",
"z": "ececab80965a5f13",
"name": "graph generate",
"func": "var payload=msg.payload;\n\nvar a1=[];\nvar a2=[];\nvar a3=[];\nvar a4=[];\nvar a5=[];\nvar a6=[];\n\nfor(let i=0;i<payload.length;i++)\n{\nvar timep=(payload[i][\"TIME\"]);\nvar temp1={\"x\": time, \"y\": parseInt(payload[i][\"A\"])};\nvar temp2={\"x\": time, \"y\": parseInt(payload[i][\"B\"])};\nvar temp3={\"x\": time, \"y\": parseInt(payload[i][\"C\"])};\nvar temp4={\"x\": time, \"y\": parseInt(payload[i][\"D\"])};\nvar temp5={\"x\": time, \"y\": parseInt(payload[i][\"E\"])};\nvar temp6={\"x\": time, \"y\": parseInt(payload[i][\"F\"])};\n\na1.push(temp1);\na2.push(temp2);\na3.push(temp3);\na4.push(temp4);\na5.push(temp5);\na6.push(temp6);\n \n \n //\n \n \n}\n\ndata_out=[a1,a2,a3,a4,a5,a6];\nmsg.payload=[{\n\"series\": [\"A\",\"B\",\"C\",\"D\",\"E\",\"F\"],\n\"DATA\":data_out,\n\"labels\": [\"A\",\"B\",\"C\",\"D\",\"E\",\"F\"]\n}];\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 340,
"y": 480,
"wires": [
[
"f62c08cb2bed5705",
"aec05244f53c2688"
]
]
},
{
"id": "aec05244f53c2688",
"type": "ui_chart",
"z": "ececab80965a5f13",
"name": "",
"group": "2ac8e3fa.8b8584",
"order": 5,
"width": 0,
"height": 0,
"label": "Time Graph Test",
"chartType": "line",
"legend": "true",
"xformat": "HH:mm:ss",
"interpolate": "linear",
"nodata": "",
"dot": false,
"ymin": "",
"ymax": "",
"removeOlder": 1,
"removeOlderPoints": "",
"removeOlderUnit": "3600",
"cutout": 0,
"useOneColor": false,
"useUTC": false,
"colors": [
"#400000",
"#ff8000",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"outputs": 1,
"useDifferentColor": false,
"className": "",
"x": 720,
"y": 380,
"wires": [
[
"f62c08cb2bed5705"
]
]
},
{
"id": "2ac8e3fa.8b8584",
"type": "ui_group",
"name": "Default",
"tab": "ebb1ed1c.5ebe2",
"order": 1,
"disp": true,
"width": "12",
"collapse": false,
"className": ""
},
{
"id": "ebb1ed1c.5ebe2",
"type": "ui_tab",
"name": "Home",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]