-
4 Sep 2012 3:10 PM #1
Unanswered: function to analyze store data then feed it to pie chart
Unanswered: function to analyze store data then feed it to pie chart
Hi everyone, so I have a store:
And a chart:Code: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'} ] });
I want the pie chart to show the grade-level distribution in my store. Do I have to write functions that analyze the store and pass new values to the pi chart? If so, where would I stick those functions in MVC architecture? Sorry if this question is too broad, I'm a beginner in extjsCode:Ext.define('AM.view.user.Chart' , { extend: 'Ext.chart.Chart', alias: 'widget.userchart', ...(basic config stuff)... series: [{ type: 'pie', //categoryField: 'Level', angleField: 'Level', showInLegend: true, }] //put functions here to analyze store? });
-
5 Sep 2012 11:05 AM #2Sencha - Support Team
- Join Date
- Jul 2010
- Location
- Houston, Tx
- Posts
- 7,185
- Vote Rating
- 194
- Answers
- 433
I am not sure I understand your request ...
Are you asking how to create calculated fields?
http://docs.sencha.com/ext-js/4-1/#!...ld-cfg-convert
If you need to create functions, you can create an 'class' and include it in your app as needed.
Scott.
-
7 Sep 2012 1:12 PM #3
Thanks for the response scott, sorry my question was so unclear.
Basically I have a store with a groupField and I would like to display those groups in a pie chart. So the group field would be the grade level and the chart would show the relative amounts of students in each grade. I don't know if there is an easy way to display fieldGroups in pie charts or if I have to calculate new fields that count up the number of entries with FR as their grade and so forth


Reply With Quote