const data = [{"id":1,"name":"AAA","value":5}, {"id":1,"name":"BBB","value":8}, {"id":1,"name":"CCC","value":9}, {"id":1,"name":"AAA","value":15}, {"id":1,"name":"BBB","value":3}, {"id":1,"name":"CCC","value":5}, {"id":1,"name":"AAA","value":3}, , {"id":1,"name":"BBB","value":10}, {"id":1,"name":"CCC","value":11}];
const temp = {};
data.forEach(row => {
if (!temp[row.name]) {
temp[row.name] = { name: row.name, data: [] };
}
temp[row.name].data.push(row.value);
});
const series = {
series: Object.keys(temp).map(name => ({ name, data: temp[name].data })),
};
console.log(series);