I got no success with a chart, using multiple lines. Maybe some can help.
This is what I have:
picture 1
picture 2
var dataArray = [[]];
var seriesArray = [];
var labelsArray = [""];
for (i=0; i< 5; i++)
{
var name = msg.payload[i].brand + " " + msg.payload[i].place + " " + msg.payload[i].street;
var preis = parseFloat(msg.payload[i].diesel);
var dateTime = Date.now();
//var timestamp = Math.floor(dateTime / 1000);
dataArray[0][i] = {"x":dateTime,"y":preis};
seriesArray[i] = name;
//node.send({payload: chart });
}
var chart = [{
"series":seriesArray,
"data":dataArray,
"labels":labelsArray
}];
var chartMsg = {payload: chart};
return chartMsg;
Flow needs "Tankerkoenig" + API Id so may be its not so usefull for you:
[
{
"id": "97dfc7db.a3c4d",
"type": "ui_chart",
"z": "30b57812.5c8b38",
"name": "Dieselpreise",
"group": "107ce709.2e71e1",
"order": 0,
"width": "6",
"height": "6",
"label": "Diesel",
"chartType": "line",
"legend": "true",
"xformat": "HH:mm:ss",
"interpolate": "linear",
"nodata": "Noch keine Daten vorhanden",
"dot": true,
"ymin": "1.00",
"ymax": "2.00",
"removeOlder": "72",
"removeOlderPoints": "",
"removeOlderUnit": "60",
"cutout": 0,
"useOneColor": false,
"colors": [
"#1f77b4",
"#aec7e8",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"useOldStyle": false,
"outputs": 1,
"x": 1530,
"y": 560,
"wires": [
[]
]
},
{
"id": "107ce709.2e71e1",
"type": "ui_group",
"z": "",
"name": "wenzlaff.info",
"tab": "7e68b62d.0b5fa",
"disp": false,
"width": "6",
"collapse": false
},
{
"id": "7e68b62d.0b5fa",
"type": "ui_tab",
"z": "",
"name": "wenzlaff.info",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]
I am unsure whats wrong, since I see no big differences to the working version of @truglodite
The chart should show a line for every entry of seriesArray and add a new entries without deleding the old once.
Thanx for your help!