PDA

View Full Version : Could Column chart xfield be flexible?



shane_china
17 May 2009, 7:27 PM
I have a jsonStore like this
var store = new Ext.data.JsonStore({
url : 'income.do',
autoLoad : true,
fields : ['business_point', 'count', 'gid']
});

and the field 'business_point' is a json object, I want its property "name" to be my xfield

I tried like this

new Ext.Panel({
iconCls : 'chart',
title : 'title,
layout : 'fit',
border : false,
height : 415,
items: {
xtype : 'columnchart',
store : store,
xField: 'business_point.name',
yField: 'count'
}
})

But 'business_point.name' didn't work. How could I do it? Thank you for your help.

shane_china
18 May 2009, 2:41 PM
put to the top and want to be answered. Thank you sincerely for your help.

Allan
5 Aug 2009, 9:26 AM
Use a mapping in the store:



new Ext.data.JsonStore({
url : 'income.do',
autoLoad : true,
reader: new Ext.data.JsonReader({
...
}, Ext.data.Record.create([
{
name: 'count'
},
{
name: 'business_point_name',
mapping: 'business_point.name'
}, ...
]))
});


and then in the chart:



...
xField: 'business_point_name',
...