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