]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | Ext.define('KitchenSink.store.StandardCharts', {\r |
2 | extend: 'Ext.data.Store',\r | |
3 | model: 'KitchenSink.model.StandardChart',\r | |
4 | \r | |
5 | storeId: 'StandardCharts',\r | |
6 | \r | |
7 | generateData: function (n, floor) {\r | |
8 | var data = [],\r | |
9 | p = (Math.random() * 11) + 1,\r | |
10 | i;\r | |
11 | \r | |
12 | floor = (!floor && floor !== 0)? 20 : floor;\r | |
13 | \r | |
14 | for (i = 0; i < (n || 12); i++) {\r | |
15 | data.push({\r | |
16 | name: Ext.Date.monthNames[i % 12],\r | |
17 | data1: Math.floor(Math.max((Math.random() * 100), floor)),\r | |
18 | data2: Math.floor(Math.max((Math.random() * 100), floor)),\r | |
19 | data3: Math.floor(Math.max((Math.random() * 100), floor)),\r | |
20 | data4: Math.floor(Math.max((Math.random() * 100), floor)),\r | |
21 | data5: Math.floor(Math.max((Math.random() * 100), floor)),\r | |
22 | data6: Math.floor(Math.max((Math.random() * 100), floor)),\r | |
23 | data7: Math.floor(Math.max((Math.random() * 100), floor)),\r | |
24 | data8: Math.floor(Math.max((Math.random() * 100), floor)),\r | |
25 | data9: Math.floor(Math.max((Math.random() * 100), floor))\r | |
26 | });\r | |
27 | }\r | |
28 | return data;\r | |
29 | },\r | |
30 | \r | |
31 | refreshData: function() {\r | |
32 | this.setData(this.generateData());\r | |
33 | },\r | |
34 | \r | |
35 | constructor: function(config) {\r | |
36 | config.data = this.generateData();\r | |
37 | this.callParent([config]);\r | |
38 | }\r | |
39 | \r | |
40 | });\r |