]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | /**\r |
2 | * Demonstrates how to use Ext.chart.BarChart\r | |
3 | */\r | |
4 | Ext.define('KitchenSink.view.chart.Bar', {\r | |
5 | extend: 'Ext.Panel',\r | |
6 | requires: [\r | |
7 | 'Ext.chart.CartesianChart', \r | |
8 | 'Ext.chart.interactions.PanZoom',\r | |
9 | 'Ext.chart.series.Bar', \r | |
10 | 'Ext.chart.axis.Numeric', \r | |
11 | 'Ext.chart.axis.Category'\r | |
12 | ],\r | |
13 | \r | |
14 | controller: {\r | |
15 | type: 'chart',\r | |
16 | defaultVisibleRange: {\r | |
17 | left: [0, 1]\r | |
18 | }\r | |
19 | },\r | |
20 | \r | |
21 | layout: 'fit',\r | |
22 | items: [{\r | |
23 | xtype: 'toolbar',\r | |
24 | docked: 'top',\r | |
25 | cls: 'charttoolbar',\r | |
26 | items: [{\r | |
27 | xtype: 'spacer'\r | |
28 | }, {\r | |
29 | iconCls: 'x-fa fa-picture-o',\r | |
30 | text: 'Theme',\r | |
31 | handler: 'onThemeChange'\r | |
32 | }, {\r | |
33 | iconCls: 'x-fa fa-refresh',\r | |
34 | text: 'Refresh',\r | |
35 | handler: function() {\r | |
36 | Ext.getStore('Pie').generateData(15);\r | |
37 | }\r | |
38 | }, {\r | |
39 | text: 'Reset',\r | |
40 | handler: 'onReset'\r | |
41 | }]\r | |
42 | }, {\r | |
43 | xtype: 'cartesian',\r | |
44 | store: 'Pie',\r | |
45 | background: 'white',\r | |
46 | flipXY: true,\r | |
47 | interactions: [{\r | |
48 | type: 'panzoom'\r | |
49 | }, {\r | |
50 | type: 'itemhighlight'\r | |
51 | }],\r | |
52 | series: [{\r | |
53 | type: 'bar',\r | |
54 | xField: 'name',\r | |
55 | yField: ['g1', 'g2', 'g3', 'g4', 'g5', 'g6'],\r | |
56 | highlightCfg: {\r | |
57 | strokeStyle: 'red',\r | |
58 | lineWidth: 3\r | |
59 | },\r | |
60 | style: {\r | |
61 | lineWidth: 2,\r | |
62 | maxBarWidth: 30,\r | |
63 | stroke: 'rgb(40,40,40)'\r | |
64 | }\r | |
65 | }],\r | |
66 | axes: [{\r | |
67 | type: 'numeric',\r | |
68 | position: 'bottom',\r | |
69 | fields: ['g1', 'g2', 'g3', 'g4', 'g5', 'g6'],\r | |
70 | grid: {\r | |
71 | even: {\r | |
72 | lineWidth: 1\r | |
73 | },\r | |
74 | odd: {\r | |
75 | stroke: '#fff'\r | |
76 | }\r | |
77 | },\r | |
78 | label: {\r | |
79 | rotate: {\r | |
80 | degrees: -90\r | |
81 | }\r | |
82 | },\r | |
83 | maxZoom: 1\r | |
84 | }, {\r | |
85 | type: 'category',\r | |
86 | position: 'left',\r | |
87 | fields: 'name',\r | |
88 | maxZoom: 4\r | |
89 | }]\r | |
90 | }],\r | |
91 | \r | |
92 | initialize: function() {\r | |
93 | this.callParent();\r | |
94 | Ext.getStore('Pie').generateData(15);\r | |
95 | var toolbar = Ext.ComponentQuery.query('toolbar', this)[0],\r | |
96 | interaction = Ext.ComponentQuery.query('interaction', this)[0];\r | |
97 | if (toolbar && interaction && !interaction.isMultiTouch()) {\r | |
98 | toolbar.add(interaction.getModeToggleButton());\r | |
99 | }\r | |
100 | },\r | |
101 | \r | |
102 | refreshData: function() {\r | |
103 | \r | |
104 | }\r | |
105 | }); |