Reputation: 1410
I'm looking to create a pie chart that displays a group field from a store. For example, if each student in my store has a 'grade' field, I want the pie chart to show the relative amount of students in each grade. Is this possible? Or does the pie chart have to display a field My store:
Ext.define('AM.store.Users', {
extend: 'Ext.data.Store',
model: 'AM.model.User',
data: [
{Name: 'derp', Grade: 'FR'},
{Name: 'herp', Grade: 'SR'},
....
{Name: 'beavis', Grade: 'SR'}
],
groupField: 'Grade',
});
My attempt at a chart:
Ext.define('AM.view.user.Chart' , {
extend: 'Ext.chart.Chart',
alias: 'widget.userchart',
width: 500,
height: 600,
animate: true,
store: 'Users',
shadow: true,
legend: { position: 'right'},
insetPadding: 25,
series: [{
type: 'pie',
angleField: 'PreReq',
showInLegend: true,
highlight: {
segment: {
margin: 20
}
}
animate: true
}]
});
thanks for any tips!
Upvotes: 0
Views: 1258
Reputation: 586
in your store you can use filtering, sorting and grouping which then reflects in your chart dyamically. you need to group your result into a series of data to present in a chart.
Upvotes: 1