Upgrade to ExtJS 4.0.2 - Released 06/09/2011
[extjs.git] / examples / charts / Gauge.js
1 /*
2
3 This file is part of Ext JS 4
4
5 Copyright (c) 2011 Sencha Inc
6
7 Contact:  http://www.sencha.com/contact
8
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file.  Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
11
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
13
14 */
15 Ext.require(['Ext.chart.*', 'Ext.chart.axis.Gauge', 'Ext.chart.series.*', 'Ext.Window']);
16
17 Ext.onReady(function () {
18
19     Ext.create('Ext.Window', {
20         width: 800,
21         height: 250,
22         minWidth: 650,
23         minHeight: 225,
24         title: 'Gauge Charts',
25         tbar: [{
26             text: 'Reload Data',
27             handler: function() {
28                 store1.loadData(generateData(1));
29                 store3.loadData(generateData(1));
30                 store4.loadData(generateData(1));
31             }
32         }],
33         layout: {
34             type: 'hbox',
35             align: 'stretch'
36         },
37         items: [{
38             xtype: 'chart',
39             style: 'background:#fff',
40             animate: {
41                 easing: 'elasticIn',
42                 duration: 1000
43             },
44             store: store1,
45             insetPadding: 25,
46             flex: 1,
47             axes: [{
48                 type: 'gauge',
49                 position: 'gauge',
50                 minimum: 0,
51                 maximum: 100,
52                 steps: 10,
53                 margin: -10
54             }],
55             series: [{
56                 type: 'gauge',
57                 field: 'data1',
58                 donut: false,
59                 colorSet: ['#F49D10', '#ddd']
60             }]
61         }, {
62             xtype: 'chart',
63             style: 'background:#fff',
64             animate: true,
65             store: store3,
66             insetPadding: 25,
67             flex: 1,
68             axes: [{
69                 type: 'gauge',
70                 position: 'gauge',
71                 minimum: 0,
72                 maximum: 100,
73                 steps: 10,
74                 margin: 7
75             }],
76             series: [{
77                 type: 'gauge',
78                 field: 'data1',
79                 donut: 30,
80                 colorSet: ['#82B525', '#ddd']
81             }]
82         }, {
83             xtype: 'chart',
84             style: 'background:#fff',
85             animate: {
86                 easing: 'bounceOut',
87                 duration: 500
88             },
89             store: store4,
90             insetPadding: 25,
91             flex: 1,
92             axes: [{
93                 type: 'gauge',
94                 position: 'gauge',
95                 minimum: 0,
96                 maximum: 100,
97                 steps: 10,
98                 margin: 7
99             }],
100             series: [{
101                 type: 'gauge',
102                 field: 'data1',
103                 donut: 80,
104                 colorSet: ['#3AA8CB', '#ddd']
105             }]
106         }]
107     }).show();
108     
109 });