/*!
 * 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', 'rj', 'sauv', 'lj'],
        data: [
                {year: 2007, rj: 226, sauv: 6, lj: 268},
                {year: 2008, rj: 285, sauv: 12, lj: 307},
                {year: 2009, rj: 282, sauv: 17, lj: 354}
              ]
    });
    
     var store_db = new Ext.data.JsonStore({
     		root: 'stat_ouv_pcl',
    		totalProperty: 'totalCount',
				url: 'get_stat_ouv.php',
        fields: ['year', 'sauv', 'rj', 'lj']
    });
    
    store_db.load();
    
    
    new Ext.Panel({
        width: 558,
        height: 300,
        renderTo: 'stat_ouverture',
        title: 'Total des jugements d\'ouverture',
        items: {
            xtype: 'stackedbarchart',
            store: store_db,
            yField: 'year',
            xAxis: new Ext.chart.NumericAxis({
                stackingEnabled: true
            }),
            series: [{
                xField: 'sauv',
                displayName: 'Jugements de sauvegarde'
            },{
                xField: 'rj',
                displayName: 'Jugements de redressement judiciaire'
            },{
                xField: 'lj',
                displayName: 'Jugements de liquidation judiciaire'
            }]
        }
    });
});
