PDA

View Full Version : [Chart] Splitting chart series into groups using a field



Kathoz
9 Dec 2011, 10:42 AM
I have a store that has these fields:



fields: [
{name: 'entityName', type: 'string'},
{name: 'startDate', type: 'date'},
{name: 'hoursSpent', type: 'int'}
]


I would like to represent this store in a line (or a (stacked) bar) chart with a separate line for each entityName field showing the hoursSpent for that entityName for the specified startDate.

Example JSON data:


[
{"entityName":"Department1","startDate":"2008-01-01","hoursSpent":"646", <...>},
{"entityName":"Department2","startDate":"2008-01-01","hoursSpent":"740", <...>},
{"entityName":"Department1","startDate":"2008-02-01","hoursSpent":"465", <...>},
{"entityName":"Department2","startDate":"2008-02-01","hoursSpent":"879", <...>},
<...>
]


How the chart should look 29901(Sorry for the crude drawing).
(http://i.imgur.com/cbcYz.png)
Is it possible to automatically split a chart series into groups based on a field's value like this? Or will I need to pivot the table manually and then use a separate series for each entityName?

Similar problem (http://www.sencha.com/forum/showthread.php?80215-Ext-Chart-how-to-plot-multiple-lines-using-one-store) (unanswered, ExtJS3)

Thank you for your time.

mitchellsimoens
9 Dec 2011, 3:02 PM
The number of series should reflect for the fields... so it's not the field values that will say how many series it will show... the number of series needs to be define when the chart is created and the fields need to exist to show data for the series.