Upgrade to ExtJS 4.0.7 - Released 10/19/2011
[extjs.git] / examples / charts / Line.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.*');
16 Ext.require(['Ext.Window', 'Ext.fx.target.Sprite', 'Ext.layout.container.Fit']);
17
18 Ext.onReady(function () {
19     store1.loadData(generateData(8));
20     
21     var win = Ext.create('Ext.Window', {
22         width: 800,
23         height: 600,
24         minHeight: 400,
25         minWidth: 550,
26         hidden: false,
27         maximizable: true,
28         title: 'Line Chart',
29         renderTo: Ext.getBody(),
30         layout: 'fit',
31         tbar: [{
32             text: 'Reload Data',
33             handler: function() {
34                 store1.loadData(generateData(8));
35             }
36         }],
37         items: {
38             xtype: 'chart',
39             style: 'background:#fff',
40             animate: true,
41             store: store1,
42             shadow: true,
43             theme: 'Category1',
44             legend: {
45                 position: 'right'
46             },
47             axes: [{
48                 type: 'Numeric',
49                 minimum: 0,
50                 position: 'left',
51                 fields: ['data1', 'data2', 'data3'],
52                 title: 'Number of Hits',
53                 minorTickSteps: 1,
54                 grid: {
55                     odd: {
56                         opacity: 1,
57                         fill: '#ddd',
58                         stroke: '#bbb',
59                         'stroke-width': 0.5
60                     }
61                 }
62             }, {
63                 type: 'Category',
64                 position: 'bottom',
65                 fields: ['name'],
66                 title: 'Month of the Year'
67             }],
68             series: [{
69                 type: 'line',
70                 highlight: {
71                     size: 7,
72                     radius: 7
73                 },
74                 axis: 'left',
75                 xField: 'name',
76                 yField: 'data1',
77                 markerConfig: {
78                     type: 'cross',
79                     size: 4,
80                     radius: 4,
81                     'stroke-width': 0
82                 }
83             }, {
84                 type: 'line',
85                 highlight: {
86                     size: 7,
87                     radius: 7
88                 },
89                 axis: 'left',
90                 smooth: true,
91                 xField: 'name',
92                 yField: 'data2',
93                 markerConfig: {
94                     type: 'circle',
95                     size: 4,
96                     radius: 4,
97                     'stroke-width': 0
98                 }
99             }, {
100                 type: 'line',
101                 highlight: {
102                     size: 7,
103                     radius: 7
104                 },
105                 axis: 'left',
106                 smooth: true,
107                 fill: true,
108                 xField: 'name',
109                 yField: 'data3',
110                 markerConfig: {
111                     type: 'circle',
112                     size: 4,
113                     radius: 4,
114                     'stroke-width': 0
115                 }
116             }]
117         }
118     });
119 });
120