Save Chart as picture to attach to mail

Try using this function node

let mydata = msg.payload;
let labels = mydata.map(a => a.Reason);

const chart = [{
    "series": [{ "mname": "BOATOPACK" }],
    "data": [
        mydata.map(a => a.Duration )
    ],
    "labels": labels

}];

msg.payload = chart;
return msg;

@colin, the example I postes earlier was a flow that Generate chart images in Node-Red for email or chat messages. After that the request was made to show how to format the data coming out of MySQL which is what this function node does.