Reputation: 3779
I'm trying to push an object that looks like this to a highcharts pie chart.
Object {
Kanye: 1,
Tupac: 5,
Biggie: 4,
Jay Z: 3,
Rick Ross: 2
}
I'm a bit confused how to turn this to an array that highchart accepts?
The following shows an example of how the array should be formatted
Any help in clarification would be much appreciated!
Upvotes: 0
Views: 492
Reputation: 796
You're going to want to make your object into an array of objects.
data = [{
name: 'Kanye',
y: 1,
}, {
name: 'Tupac',
y: 5,
}, {
name: 'Biggie',
y: 4,
}, {
name: 'Jay Z',
y: 3,
}, {
name: 'Rick Ross',
y: 2,
}]
Upvotes: 1