/*!
 * 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', 'com', 'sa', 'gie', 'sci', 'mod', 'rad'],
        data: [
                {year: 2008, com: 721, sa: 2364, gie: 4, sci: 871, mod: 7160, rad: 1993},
                {year: 2009, com: 633, sa: 2252, gie: 4, sci: 838, mod: 8834, rad: 4819}
              ]
    });
    
      var store_db = new Ext.data.JsonStore({
     		root: 'stat_rcs',
    		totalProperty: 'totalCount',
				url: 'get_stat_rcs.php',
        fields: ['year', 'com', 'sa', 'gie', 'sci', 'mod', 'rad']
    });
    
    store_db.load();
    
    new Ext.Panel({
        width: 558,
        height: 200,
        renderTo: 'stat_rcs',
        title: 'Total Registre du Commerce et des Sociétés',
        items: {
            xtype: 'stackedbarchart',
            store: store_db,
            yField: 'year',
            xAxis: new Ext.chart.NumericAxis({
                stackingEnabled: true
            }),
            series: [{
                xField: 'com',
                displayName: 'Immatriculations Commerçants'
            },{
                xField: 'sa',
                displayName: 'Immatriculations Sociétés commerciales'
            },{
                xField: 'gie',
                displayName: ' Immatriculations GIE'
            },{
                xField: 'sci',
                displayName: 'Immatriculations Sociétés civiles'
            },{
                xField: 'mod',
                displayName: 'Modifications légales'
            },{
                xField: 'rad',
                displayName: 'Radiations'
            }]
        }
    });
});