2011-12-15 27 views
0

我正在嘗試使用帶有JSONStore的Sencha觸摸圖來動態顯示由JSON,系列和數據提供的信息中的圖表。 ExtJS 3和metaData屬性可以實現這一點。動態json圖

我怎樣才能完成與Sencha觸摸圖相同?

回答

0
// Am using ruby for the webservice calls. 

// First u have to create model and store for that 



// model 
Ext.regModel('samplemodel', { 
idProperty: 'name', 
fields: [ { name: 'name', type: 'string' }, 
       { name: 'data', type: 'int' } 
      ] 
}); 

// store 
Ext.regStore('SampleStore', { 
model: 'samplemodel', 
storeId: "sampleStoreID", 
sorters: [ { 
    property: 'name' 
}] 
}); 

// and create a variable for the store 

var sampleStore = Ext.getStore("SampleStore"); 

// call the webservice and store it in array, 
// bind the response to the store, 
// use the store variable in the chart.