/*!
 * 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', 'ctx', 'exp', 'rad'],
        data: [
                {year: 2007,ctx: 861, exp: 28, rad: 45},
                {year: 2008, ctx: 619, exp: 28, rad: 31},
                {year: 2009, ctx: 754, exp: 16, rad: 71}
              ]
    });
    
     var store_db = new Ext.data.JsonStore({
     		root: 'stat_ctx',
    		totalProperty: 'totalCount',
				url: 'get_stat_ctx.php',
        fields: ['year', 'ctx', 'exp', 'rad']
    });
    
    store_db.load();
    
    
    new Ext.Panel({
        width: 558,
        height: 300,
        renderTo: 'stat_ctx',
        title: 'Total Jugements Contentieux Général',
        items: {
            xtype: 'stackedbarchart',
            store: store_db,
            yField: 'year',
            xAxis: new Ext.chart.NumericAxis({
                stackingEnabled: true
            }),
            series: [{
                xField: 'ctx',
                displayName: 'Jugements de contentieux'
            },{
                xField: 'exp',
                displayName: 'Jugements d\'expertise'
            },{
                xField: 'rad',
                displayName: 'Jugements de radiation'
            }]
        }
    });
});
