I have the next input array. It can have different phases.
[
{
"id": 1,
"phase": "Planning",
},
{
"id": 2,
"phase": "Planning",
},
{
"id": 3,
"phase": "Done",
}
]
Based on phases I want to convert it to array with next format.
[{title: 'Planning',
datasets: {data: [/* 1st item will be here*/]},
{data: [/* 2nd item will be here*/]}]},
{title: 'Done',
datasets: [{data: [/* 1st item will be here*/]}]
}
];
How can I do this?
Thanks in advance