/*!
 * 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', 'act', 'bil'],
        data: [
                {year: 2008, act: 10641, bil: 9491},
                {year: 2009, act: 11035, bil: 10938}
              ]
    });
    
     var store_db = new Ext.data.JsonStore({
     		root: 'stat_depot',
    		totalProperty: 'totalCount',
				url: 'get_stat_depot.php',
        fields: ['year', 'act', 'bil']
    });
    
    store_db.load();
    
    new Ext.Panel({
        width: 558,
        height: 200,
        renderTo: 'stat_depot',
        title: 'Total Dépôts',
        items: {
            xtype: 'stackedbarchart',
            store: store_db,
            yField: 'year',
            xAxis: new Ext.chart.NumericAxis({
                stackingEnabled: true
            }),
            series: [{
                xField: 'act',
                displayName: 'Dépôts d\'actes'
            },{
                xField: 'bil',
                displayName: 'Dépôts de comptes annuels'
            }]
        }
    });
});