I am trying to get a sunburst chart using d3.hierarchy with d3js v4 . I did the same as an example here. But since the data I was getting as an array of objects and not the same as used in the example I did add a small function so that the data would be the same as from the example. Below is the function
const arrayToObject = (array) =>
array.reduce((obj, item) => {
obj[item.name] = item
return obj
}, {})
Here is the link for the fiddle: https://jsfiddle.net/snt1/mbszu1u5/8/
Thank You.