I am looking to create a dynamic sunburst chart using echarts, specifically with a children -> grandchildren structure. I found inspiration from this example on the Echarts website. Initially, the data I received from the backend was in a flat format.
const data = [
{
region: 'EMEA',
username: 'MG',
priority: 'P3',
application: 'G1',
count: 1
},
...
]
To build the child list dynamically, I have defined it as follows: const children = ['region','application','priority'];
I need guidance on how to aggregate this data into nested structures as shown below:
const dataSet =[
name: 'India',
value: 16,
children:[
{name: 'E5',
value: 3,
children:[
{name: p3, value: 1},
{name: p2, value: 2}
]
},
...
]
Your insights and suggestions would be greatly appreciated. Thank you.