]> git.proxmox.com Git - extjs.git/blame - extjs/examples/kitchensink/classic/samples/view/charts/bar/Stacked.js
add extjs 6.0.1 sources
[extjs.git] / extjs / examples / kitchensink / classic / samples / view / charts / bar / Stacked.js
CommitLineData
6527f429
DM
1/**\r
2 * Stacked bars are multi-series bar charts where categories are stacked next to each\r
3 * other. This is typically done to visually represent the total of all categories for a\r
4 * given period or value.\r
5 */\r
6Ext.define('KitchenSink.view.charts.bar.Stacked', {\r
7 extend: 'Ext.Panel',\r
8 xtype: 'bar-stacked',\r
9 controller: 'bar-stacked',\r
10 // <example>\r
11 // Content between example tags is omitted from code preview.\r
12 bodyStyle: 'background: transparent !important',\r
13 layout: {\r
14 type: 'vbox',\r
15 pack: 'center'\r
16 },\r
17 otherContent: [{\r
18 type: 'Controller',\r
19 path: 'classic/samples/view/charts/bar/StackedController.js'\r
20 }, {\r
21 type: 'Store',\r
22 path: 'classic/samples/store/Browsers.js'\r
23 }],\r
24 // </example>\r
25\r
26 width: 650,\r
27\r
28 initComponent: function() {\r
29 var me = this;\r
30 //<example>\r
31 me.tbar = [\r
32 '->',\r
33 {\r
34 text: 'Preview',\r
35 handler: 'onPreview'\r
36 }\r
37 ];\r
38 //</example>\r
39 me.items = [{\r
40 xtype: 'cartesian',\r
41 reference: 'chart',\r
42 width: '100%',\r
43 height: 500,\r
44 legend: {\r
45 docked: 'right'\r
46 },\r
47 store: {type: 'browsers'},\r
48 insetPadding: 40,\r
49 flipXY: true,\r
50 sprites: [{\r
51 type: 'text',\r
52 text: 'Bar Charts - Stacked Bars',\r
53 fontSize: 22,\r
54 width: 100,\r
55 height: 30,\r
56 x: 40, // the sprite x position\r
57 y: 20 // the sprite y position\r
58 }, {\r
59 type: 'text',\r
60 text: 'Data: Browser Stats 2012',\r
61 fontSize: 10,\r
62 x: 12,\r
63 y: 480\r
64 }, {\r
65 type: 'text',\r
66 text: 'Source: http://www.w3schools.com/',\r
67 fontSize: 10,\r
68 x: 12,\r
69 y: 495\r
70 }],\r
71 axes: [{\r
72 type: 'numeric',\r
73 position: 'bottom',\r
74 adjustByMajorUnit: true,\r
75 fields: 'data1',\r
76 grid: true,\r
77 renderer: 'onAxisLabelRender',\r
78 minimum: 0\r
79 }, {\r
80 type: 'category',\r
81 position: 'left',\r
82 fields: 'month',\r
83 grid: true\r
84 }],\r
85 series: [{\r
86 type: 'bar',\r
87 axis: 'bottom',\r
88 title: [ 'IE', 'Firefox', 'Chrome', 'Safari' ],\r
89 xField: 'month',\r
90 yField: [ 'data1', 'data2', 'data3', 'data4' ],\r
91 stacked: true,\r
92 style: {\r
93 opacity: 0.80\r
94 },\r
95 highlight: {\r
96 fillStyle: 'yellow'\r
97 },\r
98 tooltip: {\r
99 trackMouse: true,\r
100 renderer: 'onSeriesTooltipRender'\r
101 }\r
102 }]\r
103 //<example>\r
104 }, {\r
105 style: 'margin-top: 10px;',\r
106 xtype: 'gridpanel',\r
107 columns : {\r
108 defaults: {\r
109 sortable: false,\r
110 menuDisabled: true,\r
111 renderer: 'onColumnRender'\r
112 },\r
113 items: [\r
114 { text: 'Month', dataIndex: 'month', renderer: Ext.identityFn },\r
115 { text: 'IE', dataIndex: 'data1' },\r
116 { text: 'Firefox', dataIndex: 'data2' },\r
117 { text: 'Chrome', dataIndex: 'data3' },\r
118 { text: 'Safari', dataIndex: 'data4' }\r
119 ]\r
120 },\r
121 store: {type: 'browsers'},\r
122 width: '100%'\r
123 //</example>\r
124 }];\r
125\r
126 this.callParent();\r
127 }\r
128});\r