3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js">Ext.chart.Chart.CHART_URL = '../../resources/charts.swf';
\r
10 Ext.onReady(function(){
\r
12 var store = new Ext.data.JsonStore({
\r
13 fields:['name', 'visits', 'views'],
\r
15 {name:'Jul 07', visits: 245000, views: 3000000},
\r
16 {name:'Aug 07', visits: 240000, views: 3500000},
\r
17 {name:'Sep 07', visits: 355000, views: 4000000},
\r
18 {name:'Oct 07', visits: 375000, views: 4200000},
\r
19 {name:'Nov 07', visits: 490000, views: 4500000},
\r
20 {name:'Dec 07', visits: 495000, views: 5800000},
\r
21 {name:'Jan 08', visits: 520000, views: 6000000},
\r
22 {name:'Feb 08', visits: 620000, views: 7500000}
\r
26 // extra extra simple
\r
28 title: 'ExtJS.com Visits Trend, 2007/2008 (No styling)',
\r
29 renderTo: 'container',
\r
40 itemclick: function(o){
\r
41 var rec = store.getAt(o.index);
\r
42 Ext.example.msg('Item Selected', 'You chose {0}.', rec.get('name'));
\r
51 title: 'ExtJS.com Visits Trend, 2007/2008 (Simple styling)',
\r
53 renderTo: 'container',
\r
61 url: '../../resources/charts.swf',
\r
64 yAxis: new Ext.chart.NumericAxis({
\r
65 displayName: 'Visits',
\r
66 labelRenderer : Ext.util.Format.numberRenderer('0,0')
\r
68 tipRenderer : function(chart, record){
\r
69 return Ext.util.Format.number(record.data.visits, '0,0') + ' visits in ' + record.data.name;
\r
74 // more complex with a custom look
\r
77 title: 'ExtJS.com Visits and Pageviews, 2007/2008 (Full styling)',
\r
79 renderTo: 'container',
\r
85 xtype: 'columnchart',
\r
87 url:'../../resources/charts.swf',
\r
89 yAxis: new Ext.chart.NumericAxis({
\r
90 displayName: 'Visits',
\r
91 labelRenderer : Ext.util.Format.numberRenderer('0,0')
\r
93 tipRenderer : function(chart, record, index, series){
\r
94 if(series.yField == 'visits'){
\r
95 return Ext.util.Format.number(record.data.visits, '0,0') + ' visits in ' + record.data.name;
\r
97 return Ext.util.Format.number(record.data.views, '0,0') + ' page views in ' + record.data.name;
\r
102 animationEnabled: true,
\r
127 majorTicks: {color: 0x69aBc8, length: 4},
\r
128 minorTicks: {color: 0x69aBc8, length: 2},
\r
129 majorGridLines: {size: 1, color: 0xeeeeee}
\r
133 majorTicks: {color: 0x69aBc8, length: 4},
\r
134 minorTicks: {color: 0x69aBc8, length: 2},
\r
135 majorGridLines: {size: 1, color: 0xdfe8f6}
\r
140 displayName: 'Page Views',
\r
149 displayName: 'Visits',
\r