Hello,
I'm trying to visualize sql-Data in a Chart node.
I got Data from Database as follow:
22.5.2019, 21:16:19node: b3d00608.8d4658SELECT Datum, T1, T2, T3, T4 FROM tb_Pool WHERE DATE(Datum) >= '2019-04-30' AND DATE(Datum) <= '2019-04-30' : msg : Object
object
payload: array[3]
0: object
Datum: "2019-04-30T20:32:21.000Z"
T1: 24.5
T2: 24.6
T3: 41.1
T4: 40.4
1: object
Datum: "2019-04-30T21:05:31.000Z"
T1: 24.3
T2: 24.3
T3: 27.8
T4: 40.4
2: object
Datum: "2019-04-30T21:35:37.000Z"
T1: 24.1
T2: 24.1
T3: 26.3
T4: 40.4
topic: "SELECT Datum, T1, T2, T3, T4 FROM tb_Pool WHERE DATE(Datum) >= '2019-04-30' AND DATE(Datum) <= '2019-04-30'"
I developed this function to see T1 in the Chart:
var newMsg = {};
newMsg.payload = [{
key: "Temperatur",
values:
}];
for (i = 0; i < msg.payload.length; i++) {
newMsg.payload[0].values.push(
[(msg.payload[i].Datum),
msg.payload[i].T1]);
}
msg = newMsg;
return msg;
The Chart get the data like this:
22.5.2019, 21:16:19node: c10c96e4.9419e8msg : Object
object
payload: array[1]
0: object
key: "Temperatur"
values: array[3]
0: array[2]
0: "2019-04-30T20:32:21.000Z"
1: 24.5
1: array[2]
0: "2019-04-30T21:05:31.000Z"
1: 24.3
2: array[2]
0: "2019-04-30T21:35:37.000Z"
1: 24.1
_msgid: "35ade565.76b63a"
Now I see only a straight line on 25°C?
Could someone help me?
Thank you.