I am new to node-red, i have started using Dashboard v2 and i am struggling with the way to put my data together to generate a bar chart. Between google and forums i have been able to get some bars on the graph. I am trying to get multiple bars on the same x axis. I have an array of data coming in from sql. With the code below i was able to plot some data, but i have another variable that i need to plot next to the current bar. ..
var inputArray = msg.payload;
var arrayOfObjects = [];
// Create objects and add them to the array
for (var i = 0; i < inputArray.length; i++) {
var object1 = { category: inputArray[i]["DAY"], value: inputArray[i]["MACHINE HOURS"] };
//var object2 = { category: inputArray[i]["DAY"], value: inputArray[i]["FEEDER HOURS"] };
arrayOfObjects.push(object1);
//arrayOfObjects.push(object2);
}
// Assign the array of objects to msg.payload
msg.payload = arrayOfObjects;
// Return the modified message object
return msg;
UI Graph Node setup: