2012-08-18 12:07:32 +02:00

168 lines
3.0 KiB
JavaScript

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= 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.name +")";
}
},
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
}]
}))
}
$(document).ready(function() {
});