/*!
 * Ext JS Library 3.0.3
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
Ext.chart.Chart.CHART_URL = '../ext-3.0.3/resources/charts.swf';

Ext.onReady(function(){
    var store = new Ext.data.JsonStore({
        fields: ['year', 'im', 'mod', 'rad'],
        data: [
                {year: 2008, im: 228, mod: 80, rad: 182},
                {year: 2009, im: 216, mod: 81, rad: 168}
              ]
    });
    
     var store_db = new Ext.data.JsonStore({
     		root: 'stat_agc',
    		totalProperty: 'totalCount',
				url: 'get_stat_agc.php',
        fields: ['year', 'im', 'mod', 'rad']
    });
    
    store_db.load();
    
    new Ext.Panel({
        width: 558,
        height: 200,
        renderTo: 'stat_agc',
        title: 'Total Registre Spécial des Agents Commerciaux',
        items: {
            xtype: 'stackedbarchart',
            store: store_db,
            yField: 'year',
            xAxis: new Ext.chart.NumericAxis({
                stackingEnabled: true
            }),
            series: [{
                xField: 'im',
                displayName: 'Immatriculations'
            },{
                xField: 'mod',
                displayName: 'Modifications'
            },{
                xField: 'rad',
                displayName: 'Radiations'
            }]
        }
    });
});