source: trunk/web/addons/job_monarch/lib/extjs-30/examples/chart/reload-chart.js @ 625

Last change on this file since 625 was 625, checked in by ramonb, 15 years ago

lib/extjs-30:

  • new ExtJS 3.0
File size: 1.3 KB
Line 
1/*!
2 * Ext JS Library 3.0.0
3 * Copyright(c) 2006-2009 Ext JS, LLC
4 * licensing@extjs.com
5 * http://www.extjs.com/license
6 */
7function generateData(){
8    var data = [];
9    for(var i = 0; i < 12; ++i){
10        data.push([Date.monthNames[i], (Math.floor(Math.random() *  11) + 1) * 100]);
11    }
12    return data;
13}
14
15Ext.onReady(function(){
16    var store = new Ext.data.ArrayStore({
17        fields: ['month', 'hits'],
18        data: generateData()
19    });
20   
21    new Ext.Panel({
22        width: 700,
23        height: 400,
24        renderTo: document.body,
25        title: 'Column Chart with Reload - Hits per Month',
26        tbar: [{
27            text: 'Load new data set',
28            handler: function(){
29                store.loadData(generateData());
30            }
31        }],
32        items: {
33            xtype: 'columnchart',
34            store: store,
35            yField: 'hits',
36            xField: 'month',
37            xAxis: new Ext.chart.CategoryAxis({
38                title: 'Month'
39            }),
40            yAxis: new Ext.chart.NumericAxis({
41                title: 'Hits'
42            }),
43            extraStyle: {
44               xAxis: {
45                    labelRotation: -90
46                }
47            }
48        }
49    });
50});
Note: See TracBrowser for help on using the repository browser.