//= require jquery
//= require jquery_ujs
//= require_tree .




function resize(){

	$("#main").css('min-height',$(window).height()-$(window).width()*0.04);

}

$(document).ready(function(){
	
	resize();
});


var charts = [];
var getChartConfig = function(renderId, title, data, Categories) {
    var config = {};
    config.chart = {
         renderTo: renderId,
         plotBackgroundColor: null,
         plotBorderWidth: null,
         plotShadow: false,
		 backgroundColor:'rgba(255, 255, 255, 0)'
             
    };
	

	
    config.title = false;
       
    config.legend = { enabled: false };
    config.tooltip = {
        formatter: function() {
            return '<b>'+ this.point.name +'</b>: '+ this.y +' %';
        }
            
    };
    config.plotOptions= {
        pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            dataLabels: {
                enabled: true,
                color: '#000000',
                connectorColor: '#000000',
                formatter: function() {
                    return '<b>'+ this.point.name +'</b>: '+ this.y +' personne(s) ('+this.point.per+")";
                }
            }
        }
    };
		
		
    config.series = [{
        type: 'pie',
        name: 'Browser share',
        data: data
    }];
	
	config.credits =  {
		position: {
			align: 'right',
			x: -10,
			verticalAlign: 'bottom',
				
		},
		text: 'Sondage "sorties du Pic Vert" - Août 2012',
		href : 'javascript:return false;'
	};
	

    return config;
};


var columns = [];

function chartbar(Container, Datas, Categories, Title){

	columns.push(new Highcharts.Chart({
		chart: {
			renderTo: Container,
			type: 'column',
			spacingBottom : 30,
			spacingTop : 30,
		 backgroundColor:'rgba(255, 255, 255, 0)'
		},
		title: false,
		subtitle: false,
		xAxis: {
			categories: Categories,
			title: false
			
		},
		yAxis: {
			min: 0,
			title: false,
			labels: {
				overflow: 'justify'
			},
			allowDecimals:false
		},
		tooltip: {
			formatter: function() {
				return ''+
					this.x +' : '+ this.y +' personne(s) ('+ this.point.per +")";
			}
		},
		plotOptions: {
			bar: {
				dataLabels: {
					enabled: true
				}
			}
		},
		legend: false,
		credits: {
			position: {
				align: 'right',
				x: -10,
				verticalAlign: 'bottom',
				
			},
			text: 'Sondage "sorties du Pic Vert" - Août 2012',
		href : 'javascript:return false;'
		},
			series: [{
		
			data: Datas
		}]
	}))


}