



$(document).ready(function(){
    
    
    /*******************plot***********************/
   
    if($("#graph1").attr('id')){
        var data1 = [[[5971,2010]],[[6394,2011]], [[6964,2012]]];
        var ticks = ['2012', '2011', '2010'];
        var plot1 = $.jqplot('graph1', data1, {
            seriesDefaults: {
                renderer:$.jqplot.BarRenderer,
                pointLabels: {
                    show: true, 
                    location: 'e', 
                    edgeTolerance: -15
                },
                shadowAngle: 135,
                rendererOptions: {
                    barDirection: 'horizontal'
                }
            },
            legend: {
                show: true,
                placement: 'outsideGrid'
            },
            series:[{
                label:'2010'
            },{
                label:'2011'
            },{
                label:'2012'
            }],
            seriesColors: ["#84A143",'#9C2E2C','#2C5B94'],
            axes: {
                yaxis: {
                    renderer: $.jqplot.CategoryAxisRenderer,
                    ticks: ticks
                }
            
            }
        });
    }
    if($("#graph2").attr('id')){
        var data2 = [[[5200,2010]],[[5532,2011]], [[6087,2012]]];
        var ticks2 = ['2012', '2011', '2010'];
        var plot2 = $.jqplot('graph2', data2, {
            seriesDefaults: {
                renderer:$.jqplot.BarRenderer,
                pointLabels: {
                    show: true, 
                    location: 'e', 
                    edgeTolerance: -15
                },
                shadowAngle: 135,
                rendererOptions: {
                    barDirection: 'horizontal'
                }
            },
            legend: {
                show: true,
                placement: 'outsideGrid'
            },
            series:[{
                label:'2010'
            },{
                label:'2011'
            },{
                label:'2012'
            }],
            seriesColors: ["#84A143",'#9C2E2C','#2C5B94'],
            axes: {
                yaxis: {
                    renderer: $.jqplot.CategoryAxisRenderer,
                    ticks: ticks2
                }
            
            }
        });
    }
    if($("#graph3").attr('id')){
        var data3 = [
        ['О неисполнении (ненадлежащем исполнении) обязательств', 2011],['Банкротство', 643], ['Административные правонарушения',687], 
        ['Оспаривание ненормативных актов', 511],['Налоговые споры', 443], ['Земельные споры', 442], ['Споры, связанные с внедоговорными обязательствами', 273]
        , ['Остальные споры', 1077]
        ];
        var plot3 = jQuery.jqplot ('graph3', [data3], {
            seriesDefaults: {
                renderer: jQuery.jqplot.PieRenderer, 
                rendererOptions: {
                    fill: true,
                    showDataLabels: true, 
                    sliceMargin: 1, 
                    lineWidth: 1
                }
            }, 
            legend: {
                show: false
            },
            seriesColors: ['#264F81','#B4601B','#216F84','#513A6F','#8A2826','#6B8730','#667CA1','#AB6C6B']
        });
    }
    if($("#graph4").attr('id')){
        var data4 = [[[71,2010]],[[52,2011]], [[67,2012]]];
        var ticks4 = ['2012', '2011', '2010'];
        var plot4 = $.jqplot('graph4', data4, {
            seriesDefaults: {
                renderer:$.jqplot.BarRenderer,
                pointLabels: {
                    show: true, 
                    location: 'e', 
                    edgeTolerance: -15
                },
                shadowAngle: 135,
                rendererOptions: {
                    barDirection: 'horizontal'
                }
            },
            legend: {
                show: true,
                placement: 'outsideGrid'
            },
            series:[{
                label:'2010'
            },{
                label:'2011'
            },{
                label:'2012'
            }],
            seriesColors: ["#84A143",'#9C2E2C','#2C5B94'],
            axes: {
                yaxis: {
                    renderer: $.jqplot.CategoryAxisRenderer,
                    ticks: ticks4
                }
            
            }
        });
    }
    if($("#graph5").attr('id')){
        var data5 = [];
        data5[2010]=96;
        data5[2011]=22;
        
        var plot5 = $.jqplot('graph5', [data5], {
            seriesDefaults: {
                renderer: $.jqplot.BarRenderer
            },
            series:[
            {
                pointLabels:{
                    show: true,
                    labels:['2011', '2012']
                }
            }],
            seriesColors: ["#84A143",'#9C2E2C','#2C5B94'],
            axes: {
                xaxis:{
                    renderer:$.jqplot.CategoryAxisRenderer,
                    max:2013,
                    min:2010
                },
                yaxis:{
                    padMax:1.2
                }
            }
        });
    }
    if($("#graph6").attr('id')){
        var data6 = [];
        data6[2010]=173;
        data6[2011]=23;
        
        var plot6 = $.jqplot('graph6', [data6], {
            seriesDefaults: {
                renderer: $.jqplot.BarRenderer
            },
            series:[
            {
                pointLabels:{
                    show: true,
                    labels:['2011', '2012']
                }
            }],
            seriesColors: ['#9C2E2C','#2C5B94'],
            axes: {
                xaxis:{
                    renderer:$.jqplot.CategoryAxisRenderer,
                    max:2013,
                    min:2010
                },
                yaxis:{
                    padMax:1.2
                }
            }
        });
    }
    if($("#graph7").attr('id')){
        var s1 = [[2010,156], [2011,181], [2012,180]];
        var s2 = [[2010,148], [2011,125], [2012,177]];
        var s3 = [[2010,109], [2011,78], [2012,68]];
        var s4 = [[2010,178], [2011,159], [2012,158]];
        var s5 = [[2010,176], [2011,171], [2012,156]];
        plot3 = $.jqplot('graph7', [s1, s2, s3,s4,s5], {
            // Tell the plot to stack the bars.
            stackSeries: true,
            captureRightClick: true,
            seriesDefaults:{
                renderer:$.jqplot.BarRenderer,
                rendererOptions: {
                    // Put a 30 pixel margin between bars.
                    barMargin: 30,
                    // Highlight bars when mouse button pressed.
                    // Disables default highlighting on mouse over.
                    highlightMouseDown: true   
                },
                pointLabels: {
                    show: true
                }
            },
            series:[{
                label:'Брянской области'
            },{
                label:'Калужской области'
            },{
                label:'Рязанской области'
            },{
                label:'Тульской области'
            },{
                label:'Смоленской области'
            }],
            axes: {
                xaxis: {
                    renderer: $.jqplot.CategoryAxisRenderer,
                    numberTicks:5,
                    min:2009,
                    max:2013,
                    tickOptions: {
                        formatString: '%d'
                    }
                },
                yaxis: {
                    // Don't pad out the bottom of the data range.  By default,
                    // axes scaled as if data extended 10% above and below the
                    // actual range to prevent data points right on grid boundaries.
                    // Don't want to do that here.
                    padMin: 1
                }
            },
            legend: {
                show: true,
                location: 'e',
                placement: 'outside'
            }      
        });
    }
    if($("#graph9").attr('id')){
        $.jqplot("graph9",  [ [
            [2010,421], [2011,400], [2012,378]
            ] ],{
                axes: {
                    xaxis: {
                        renderer: $.jqplot.CategoryAxisRenderer,
                        numberTicks:5,
                        min:2009,
                        max:2013,
                        tickOptions: {
                            formatString: '%d'
                        }
                    },
                    yaxis: {
                        // Don't pad out the bottom of the data range.  By default,
                        // axes scaled as if data extended 10% above and below the
                        // actual range to prevent data points right on grid boundaries.
                        // Don't want to do that here.
                        padMin: 1
                    }
                }
            });
    }
       
    if($("#graph8").attr('id')){
        var data8 = [
        [[102,2010], [130,2011], [96,2012],], 
        [[265,2010], [176,2011], [138,2012]], 
        [[155,2010], [171,2011], [216,2012]], 
        [[172,2010], [172,2011], [187,2012]]
        ];
        var ticks8 = ['2012', '2011', '2010'];
        var plot8 = $.jqplot('graph8',data8, {
            seriesDefaults: {
                renderer:$.jqplot.BarRenderer,
                // Show point labels to the right ('e'ast) of each bar.
                // edgeTolerance of -15 allows labels flow outside the grid
                // up to 15 pixels.  If they flow out more than that, they 
                // will be hidden.
                pointLabels: {
                    show: true, 
                    location: 'e', 
                    edgeTolerance: -15
                },
                // Rotate the bar shadow as if bar is lit from top right.
                shadowAngle: 135,
                // Here's where we tell the chart it is oriented horizontally.
                rendererOptions: {
                    barDirection: 'horizontal'
                }
            },
            series:[{
                label:'Нарушение норм процессуального права'
            },{
                label:'Нарушение норм материального права'
            },{
                label:'Несоответствие выводов суда обстоятельствам дела'
            },{
                label:'Неполное выполнение обстоятельств дела'
            }],
            legend: {
                show: true,
                location: 'e',
                placement: 'outside'
            },
            axes: {
                yaxis: {
                    renderer: $.jqplot.CategoryAxisRenderer,
                    min:2009,
                    max:2013,
                    numberTicks:10,
                    tickOptions: {
                        formatString: '%d'
                    }
                },
                xaxis: {
                    renderer: $.jqplot.CategoryAxisRenderer
                }
            }
        });
    }
});


