/*!
 * 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', 'ref', 'ip', 'pdt'],
        data: [
                {year: 2007, ref: 287, ip: 1573, pdt: 565},
                {year: 2008, ref: 219, ip: 1789, pdt: 824},
                {year: 2009, ref: 279, ip: 2120, pdt: 993}
              ]
    });
    
     var store_db = new Ext.data.JsonStore({
     		root: 'stat_ord',
    		totalProperty: 'totalCount',
				url: 'get_stat_ord.php',
        fields: ['year', 'ref', 'ip', 'pdt']
    });
    
    store_db.load();
    
    new Ext.Panel({
        width: 558,
        height: 300,
        renderTo: 'stat_ord',
        title: 'Total des ordonnances',
        items: {
            xtype: 'stackedbarchart',
            store: store_db,
            yField: 'year',
            xAxis: new Ext.chart.NumericAxis({
                stackingEnabled: true
            }),
            series: [{
                xField: 'ref',
                displayName: 'Ordonnances de référé'
            },{
                xField: 'ip',
                displayName: 'Ordonnances d\'injonction de payer'
            },{
                xField: 'pdt',
                displayName: 'Ordonnances du Président'
            }]
        }
    });
});
