]> git.proxmox.com Git - extjs.git/blame - extjs/examples/kitchensink/classic/samples/view/charts/combination/Pareto.js
add extjs 6.0.1 sources
[extjs.git] / extjs / examples / kitchensink / classic / samples / view / charts / combination / Pareto.js
CommitLineData
6527f429
DM
1/**\r
2 * Pareto chart, named after Vilfredo Pareto, is a chart that contains both column and\r
3 * line chart. Individual values are represented in descending order by bars, and the\r
4 * cumulative total is represented by the line.\r
5 */\r
6Ext.define('KitchenSink.view.charts.combination.Pareto', {\r
7 extend: 'Ext.Panel',\r
8 requires: 'Ext.chart.theme.Category2',\r
9 xtype: 'combination-pareto',\r
10 controller: 'combination-pareto',\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/combination/ParetoController.js'\r
22 }, {\r
23 type: 'Store',\r
24 path: 'classic/samples/store/Pareto.js'\r
25 }],\r
26 // </example>\r
27 width: 650,\r
28\r
29 dockedItems: [{\r
30 xtype: 'toolbar',\r
31 dock: 'top',\r
32 items: [\r
33 '->',\r
34 {\r
35 text: Ext.os.is.Desktop ? 'Download' : 'Preview',\r
36 handler: 'onDownload'\r
37 }]\r
38 }],\r
39\r
40 items: [{\r
41 xtype: 'cartesian',\r
42 reference: 'chart',\r
43 theme: 'category2',\r
44 width: '100%',\r
45 height: 500,\r
46 store: {\r
47 type: 'pareto'\r
48 },\r
49 insetPadding: '40 40 20 40',\r
50 legend: {\r
51 docked: 'bottom'\r
52 },\r
53 sprites: [{\r
54 type: 'text',\r
55 text: 'Restaurant Complaints by Reported Cause',\r
56 fontSize: 22,\r
57 width: 100,\r
58 height: 30,\r
59 x: 40, // the sprite x position\r
60 y: 20 // the sprite y position\r
61 }, {\r
62 type: 'text',\r
63 text: 'Data: Restaurant Complaints',\r
64 font: '10px Helvetica',\r
65 x: 12,\r
66 y: 480\r
67 }],\r
68 axes: [{\r
69 type: 'numeric',\r
70 position: 'left',\r
71 fields: ['count'],\r
72 majorTickSteps: 10,\r
73 reconcileRange: true,\r
74 grid: true,\r
75 minimum: 0\r
76 }, {\r
77 type: 'category',\r
78 position: 'bottom',\r
79 fields: 'complaint',\r
80 label: {\r
81 rotate: {\r
82 degrees: -45\r
83 }\r
84 }\r
85 }, {\r
86 type: 'numeric',\r
87 position: 'right',\r
88 fields: ['cumnumber'],\r
89 reconcileRange: true,\r
90 majorTickSteps: 10,\r
91 renderer: 'onAxisLabelRender'\r
92 }],\r
93 series: [{\r
94 type: 'bar',\r
95 title: 'Causes',\r
96 xField: 'complaint',\r
97 yField: 'count',\r
98 style: {\r
99 opacity: 0.80\r
100 },\r
101 highlight: {\r
102 fillStyle: 'rgba(204, 230, 73, 1.0)',\r
103 strokeStyle: 'black'\r
104 },\r
105 tooltip: {\r
106 trackMouse: true,\r
107 renderer: 'onBarSeriesTooltipRender'\r
108 }\r
109 }, {\r
110 type: 'line',\r
111 title: 'Cumulative %',\r
112 xField: 'complaint',\r
113 yField: 'cumnumber',\r
114 style: {\r
115 lineWidth: 2,\r
116 opacity: 0.80\r
117 },\r
118 marker: {\r
119 type: 'cross',\r
120 fx: {\r
121 duration: 200\r
122 }\r
123 },\r
124 highlightCfg: {\r
125 scaling: 2,\r
126 rotationRads: Math.PI / 4\r
127 },\r
128 tooltip: {\r
129 trackMouse: true,\r
130 renderer: 'onLineSeriesTooltipRender'\r
131 }\r
132 }]\r
133 //<example>\r
134 }, {\r
135 style: 'padding-top: 10px;',\r
136 xtype: 'gridpanel',\r
137 columns : {\r
138 defaults: {\r
139 sortable: false,\r
140 menuDisabled: true\r
141 },\r
142 items: [\r
143 { text: 'Complaint', dataIndex: 'complaint', width: 175 },\r
144 { text: 'Count', dataIndex: 'count' },\r
145 { text: 'Cumulative', dataIndex: 'cumnumber' },\r
146 { text: 'Cumulative %', dataIndex: 'cumpercent', width: 175, renderer: 'onPercentRender' }\r
147 ]\r
148 },\r
149 store: {\r
150 type: 'pareto'\r
151 },\r
152 width: '100%'\r
153 //</example>\r
154 }]\r
155\r
156});\r