I want to create a pie chart in a view under MVC and follow the Pie chart example. There is one function generateData() which is used to generate data for the store. I need call store.loadData(generateData()) to load data. Here is the store definition
my question: where to put the generateData() definition? I always got one "generateData() is not defined"
I think the correct way is define store as a property within a chart, and define generateData() within the initComponent() block. also call store.loadData(generateData()) within it. here is the snippet:
Can anyone help me out? How to define this kind of store in MVC. Following is my code snippet:
Ext.define('FSSP.store.pie', {
extend: 'Ext.data.Store',
generateData : function(n, floor){
var data = [],
p = (Math.random() * 11) + 1,
i;
in my view I refer the store
Ext.define('FSSP.view.center.piechart', {
...
store: 'pie',
...
initComponent: function() {
this.store = Ext.StoreManager.lookup(this.store);
this.store.loadData(generateData(6, 20));
this.callParent(arguments);
}
I always get a store is undefined error, and generateData is undefined error.