]> git.proxmox.com Git - extjs.git/blame - extjs/build/examples/kitchensink/classic/samples/view/charts/combination/Dashboard.js
add extjs 6.0.1 sources
[extjs.git] / extjs / build / examples / kitchensink / classic / samples / view / charts / combination / Dashboard.js
CommitLineData
6527f429
DM
1/**\r
2 * An example of an interactive dashboard showing companies data in a grid. Selecting a\r
3 * row highlights the bar corresponding to that company and updates the form with the\r
4 * company data. Additionally, a radar chart also shows the company information. The form\r
5 * can be updated to see live changes on the dashboard.\r
6 */\r
7Ext.define('KitchenSink.view.charts.combination.Dashboard', {\r
8 extend: 'Ext.Panel',\r
9 xtype: 'combination-dashboard',\r
10 controller: 'combination-dashboard',\r
11\r
12 requires: [\r
13 'Ext.form.Panel',\r
14 'Ext.form.FieldSet',\r
15 'Ext.form.field.Number'\r
16 ],\r
17\r
18 // <example>\r
19 // Content between example tags is omitted from code preview.\r
20 bodyStyle: 'background: transparent !important',\r
21 layout: {\r
22 type: 'vbox',\r
23 pack: 'center'\r
24 },\r
25 otherContent: [{\r
26 type: 'Controller',\r
27 path: 'classic/samples/view/charts/combination/DashboardController.js'\r
28 }, {\r
29 type: 'Store',\r
30 path: 'classic/samples/store/Dashboard.js'\r
31 }],\r
32 // </example>\r
33 width: 700,\r
34\r
35 items: [{\r
36 xtype: 'panel',\r
37 width: '100%',\r
38 height: 510,\r
39 bodyPadding: 10,\r
40\r
41 layout: {\r
42 type: 'vbox',\r
43 align: 'stretch'\r
44 },\r
45\r
46 fieldDefaults: {\r
47 labelAlign: 'left',\r
48 msgTarget: 'side'\r
49 },\r
50\r
51 items: [\r
52 {\r
53 xtype: 'container',\r
54 height: 250,\r
55 layout: {\r
56 type: 'hbox',\r
57 align: 'stretch'\r
58 },\r
59 items: [{\r
60 // Create a bar series to be at the top of the panel.\r
61 xtype: 'cartesian',\r
62 reference: 'barChart',\r
63 height: 250,\r
64 flex: 1,\r
65 margin: '0 0 3 0',\r
66 cls: 'x-panel-body-default',\r
67 interactions: 'itemhighlight',\r
68 style: {\r
69 border: 0\r
70 },\r
71 animation: {\r
72 easing: 'easeOut',\r
73 duration: 300\r
74 },\r
75 axes: [{\r
76 type: 'numeric',\r
77 position: 'left',\r
78 fields: 'price',\r
79 minimum: 0,\r
80 hidden: true\r
81 }, {\r
82 type: 'category',\r
83 position: 'bottom',\r
84 fields: ['name'],\r
85 label: {\r
86 fontSize: 11,\r
87 rotate: {\r
88 degrees: -45\r
89 },\r
90 renderer: 'onBarChartAxisLabelRender'\r
91 }\r
92 }],\r
93 series: {\r
94 type: 'bar',\r
95 style: {\r
96 fillStyle: '#a2b6cf'\r
97 },\r
98 highlight: {\r
99 fillStyle: '#619fff',\r
100 strokeStyle: 'black'\r
101 },\r
102 label: {\r
103 display: 'insideEnd',\r
104 field: 'price',\r
105 orientation: 'vertical',\r
106 textAlign: 'middle'\r
107 },\r
108 xField: 'name',\r
109 yField: 'price'\r
110 },\r
111 listeners: {\r
112 itemhighlight: 'onItemHighlight'\r
113 }\r
114 }, {\r
115 // Radar chart will render information for a selected company in the list.\r
116 // Selection can also be done via clicking on the bars in the series.\r
117 xtype: 'polar',\r
118 reference: 'radarChart',\r
119 margin: '0 0 0 0',\r
120 width: 200,\r
121 store: {\r
122 fields: ['Name', 'Data'],\r
123 data: [\r
124 { 'Name': 'Price', 'Data': 100 },\r
125 { 'Name': 'Revenue %', 'Data': 100 },\r
126 { 'Name': 'Growth %', 'Data': 100 },\r
127 { 'Name': 'Product %', 'Data': 100 },\r
128 { 'Name': 'Market %', 'Data': 100 }\r
129 ]\r
130 },\r
131 theme: 'Blue',\r
132 interactions: 'rotate',\r
133 insetPadding: '15 30 15 30',\r
134 axes: [{\r
135 type: 'category',\r
136 position: 'angular',\r
137 grid: true,\r
138 label: {\r
139 fontSize: 10\r
140 }\r
141 }, {\r
142 type: 'numeric',\r
143 miniumum: 0,\r
144 maximum: 100,\r
145 majorTickSteps: 5,\r
146 position: 'radial',\r
147 grid: true\r
148 }],\r
149 series: [{\r
150 type: 'radar',\r
151 xField: 'Name',\r
152 yField: 'Data',\r
153 showMarkers: true,\r
154 marker: {\r
155 radius: 4,\r
156 size: 4,\r
157 fillStyle: 'rgb(69,109,159)'\r
158 },\r
159 style: {\r
160 fillStyle: 'rgb(194,214,240)',\r
161 opacity: 0.5,\r
162 lineWidth: 0.5\r
163 }\r
164 }]\r
165 }]\r
166 },\r
167 {\r
168 xtype: 'container',\r
169 layout: {\r
170 type: 'hbox',\r
171 align: 'stretch'\r
172 },\r
173 flex: 3,\r
174 items: [\r
175 {\r
176 // Create a grid that will list the dataset items.\r
177 xtype: 'gridpanel',\r
178 reference: 'gridPanel',\r
179 flex: 6,\r
180 defaults: {\r
181 sortable: true\r
182 },\r
183 columns: [\r
184 {\r
185 text: 'Company',\r
186 flex: 1,\r
187 dataIndex: 'name'\r
188 },\r
189 {\r
190 text: 'Price',\r
191 width: null,\r
192 dataIndex: 'price',\r
193 formatter: 'usMoney'\r
194 },\r
195 {\r
196 text: 'Revenue',\r
197 width: null,\r
198 dataIndex: 'revenue',\r
199 renderer: 'onColumnRender'\r
200 },\r
201 {\r
202 text: 'Growth',\r
203 width: null,\r
204 dataIndex: 'growth',\r
205 renderer: 'onColumnRender',\r
206 hidden: true\r
207 },\r
208 {\r
209 text: 'Product',\r
210 width: null,\r
211 dataIndex: 'product',\r
212 renderer: 'onColumnRender',\r
213 hidden: true\r
214 },\r
215 {\r
216 text: 'Market',\r
217 width: null,\r
218 dataIndex: 'market',\r
219 renderer: 'onColumnRender',\r
220 hidden: true\r
221 }\r
222 ],\r
223\r
224 listeners: {\r
225 selectionchange: 'onSelectionChange'\r
226 }\r
227 },\r
228 {\r
229 xtype: 'form',\r
230 reference: 'form',\r
231 flex: 3,\r
232 layout: {\r
233 type: 'vbox',\r
234 align:'stretch'\r
235 },\r
236 margin: '0 0 0 5',\r
237 items: [{\r
238 xtype: 'fieldset',\r
239 reference: 'fieldset',\r
240 margin: 2,\r
241 flex: 1,\r
242 title: 'No company selected',\r
243 defaults: {\r
244 disabled: true,\r
245 // min/max will be ignored by the text field.\r
246 maxValue: 100,\r
247 minValue: 0,\r
248 anchor: '100%',\r
249 labelWidth: 90,\r
250 enforceMaxLength: true,\r
251 maxLength: 5,\r
252 bubbleEvents: ['change']\r
253 },\r
254 defaultType: 'numberfield',\r
255 items: [{\r
256 fieldLabel: 'Price',\r
257 name: 'price'\r
258 }, {\r
259 fieldLabel: 'Revenue %',\r
260 name: 'revenue'\r
261 }, {\r
262 fieldLabel: 'Growth %',\r
263 name: 'growth'\r
264 }, {\r
265 fieldLabel: 'Product %',\r
266 name: 'product'\r
267 }, {\r
268 fieldLabel: 'Market %',\r
269 name: 'market'\r
270 }]\r
271 }],\r
272 listeners: {\r
273 // Buffer so we don't refire while the user is still typing.\r
274 buffer: 200,\r
275 change: 'onFormChange'\r
276 }\r
277 }]\r
278 }]\r
279 }],\r
280\r
281 listeners: {\r
282 afterrender: 'onAfterRender'\r
283 }\r
284\r
285});\r
286\r