Hi.
As you have provided no example data its impossible to demonstrate changing your data into the correct format.
All I can do is offer some advice in the form of an annotated screenshot and sample code...
FOREWORD - it looks far more complicated than it actually is. Also, the code is longhand to show you what is happening
//1. lets create a variable to hold the finished article...
let chartData = []; //See #1 - create an empty array
//2. lets create a variable to hold the everything...
let element1 = {}; //create element1 as an empty object {}
//3, now add the .property "series" to the element1 {object}
element1.series = []; // add a .property called series of type [array]
element1.series.push("A"); //add 1st array element "A"
element1.series.push("B"); //add another array element "B"
element1.series.push("C"); //add another array element "C"
//4. now add the .property "data" to the element1 {object}
element1.data = []; // add a .property called data of type [array]
/*********** NEXT - ADDING DATA ***************************
NORMALLY, ADDING DATA WOULD BE DYNAMIC
PERHAPS LOOPING THROUGH AN ARRAY
THIS EXAMPLE SHOWS ADDING HARD CODED VALUES
************************************************************/
//4b. now we add 3 arrays to the data [array]
var dataElement1 = [];
var dataElement2 = [];
var dataElement3 = [];
//4c. now add the 3 {objects} inside each of the dataElements
dataElement1.push( { "x": 1504029632890, "y": 5 }); //add hard coded x & y values
dataElement1.push( { "x": 1504029636001, "y": 4 }); //add hard coded x & y values
dataElement1.push( { "x": 1504029638656, "y": 2 }); //add hard coded x & y values
dataElement2.push( { "x": 1504029633514, "y": 6 }); //add hard coded x & y values
dataElement2.push( { "x": 1504029636622, "y": 7 }); //add hard coded x & y values
dataElement2.push( { "x": 1504029639539, "y": 6 }); //add hard coded x & y values
dataElement3.push( { "x": 1504029634400, "y": 7 }); //add hard coded x & y values
dataElement3.push( { "x": 1504029637959, "y": 7 }); //add hard coded x & y values
dataElement3.push( { "x": 1504029640317, "y": 7 }); //add hard coded x & y values
//now we need to push the dataelements into the data [array]
element1.data.push(dataElement1);
element1.data.push(dataElement2);
element1.data.push(dataElement3);
/*******************************************/
//5. now add a labels [array] to element1
element1.labels = []; // add a .property called labels of type [array]
element1.labels.push(""); //add an empty string to the "labels" [array]
//Now add the element1 [array] into the chartData [array]
chartData.push(element1)
//Lastly, return the chartData as the payload
msg.payload = chartData;
return msg;
Here you can see it in action...