Hello,
I want to take the Values from my Databse (temperature and date) and Display them into a Chart.
I want to know how to loop the Array, so if i add more values i dont have to add them manualy to the chart.
I tried to do it with a for loop, but I didnt wanted to work for me.
In the future i just want to display for exmaple the last 30 min.
Hope you know what im trying to do
Im also getting the error message: "Bad data inject"
[
{
"id": "6dcc085f.8aae88",
"type": "tab",
"label": "Flow 2",
"disabled": false,
"info": ""
},
{
"id": "c83a55f7.9707f8",
"type": "mysql",
"z": "6dcc085f.8aae88",
"mydb": "6f90c35b.00d35c",
"name": "",
"x": 540,
"y": 320,
"wires": [
[
"6bb9b1.12c8965",
"780899de.750f58"
]
]
},
{
"id": "6bb9b1.12c8965",
"type": "debug",
"z": "6dcc085f.8aae88",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"x": 870,
"y": 280,
"wires": []
},
{
"id": "6a612d33.ec8064",
"type": "function",
"z": "6dcc085f.8aae88",
"name": "Query",
"func": "msg.topic = \"SELECT temperature,date FROM processvalue\"\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 370,
"y": 320,
"wires": [
[
"c83a55f7.9707f8"
]
]
},
{
"id": "780899de.750f58",
"type": "ui_chart",
"z": "6dcc085f.8aae88",
"name": "",
"group": "33603f93.9c94e",
"order": 0,
"width": 0,
"height": 0,
"label": "chart",
"chartType": "line",
"legend": "false",
"xformat": "HH:mm:ss",
"interpolate": "linear",
"nodata": "",
"dot": false,
"ymin": "",
"ymax": "",
"removeOlder": "5",
"removeOlderPoints": "",
"removeOlderUnit": "60",
"cutout": 0,
"useOneColor": false,
"colors": [
"#1f77b4",
"#aec7e8",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"useOldStyle": false,
"x": 870,
"y": 380,
"wires": [
[],
[]
]
},
{
"id": "308ee1ab.ecc5ce",
"type": "inject",
"z": "6dcc085f.8aae88",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 220,
"y": 320,
"wires": [
[
"6a612d33.ec8064"
]
]
},
{
"id": "6f90c35b.00d35c",
"type": "MySQLdatabase",
"z": "",
"host": "localhost",
"port": "3306",
"db": "nodered",
"tz": ""
},
{
"id": "33603f93.9c94e",
"type": "ui_group",
"z": "",
"name": "Default",
"tab": "65b7f908.1d1348",
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "65b7f908.1d1348",
"type": "ui_tab",
"z": "",
"name": "Home",
"icon": "dashboard"
}
]