[英]Extjs 4: pie chart display groupField from store
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! 感谢您的任何提示!
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.
您需要将结果分组为一系列数据以呈现在图表中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.