// called to test if thresholds mus be visible or not
// if it contains NaN values, display is not correct
Array.prototype.containsNaN = function() {
for (var i = 1; i < this.length; i++) {
if (isNaN(this[i]))
return false;
}
return true;
}
$(document).ready(function() {
let titleSize = '1.3em';
let tooltipSize = '1.2em';
let legendSize = '1.2em';
/**
* // to change color palette
*
Highcharts.setOptions({
// colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4']
//colors : ["#DDDF0D", "#55BF3B", "#DF5353", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee","#55BF3B", "#DF5353", "#7798BF", "#aaeeee"]
// colors: ["#7cb5ec", "#f7a35c", "#90ee7e", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee","#55BF3B", "#DF5353", "#7798BF", "#aaeeee"]
colors: ["#f45b5b", "#8085e9", "#8d4654", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee","#55BF3B", "#DF5353", "#7798BF", "#aaeeee"]
});
* */
if (lang == 'fr') {
Highcharts.setOptions({
lang: {
decimalPoint: ',',
thousandsSep: ' '
}
});
}
$('#ener-chart').highcharts({
chart: {
type: 'pie',
},
credits: false,
title: {
//text: input['conso-ener']['viz_title'] + ' ' + input['conso-ener']['date_published']
text:null
},
subtitle: {
text: input['conso-ener']['yAxis_title'] + ' - ' + input['conso-ener']['date_published'], // + ' ' + input['conso-ener']['negative_notice'],
style: {
fontSize: titleSize
}
},
tooltip: {
pointFormat: '{series.name} : {point.y} ({point.percentage:,.2f} %)',
style: {
fontSize: tooltipSize
}
},
legend: {
itemStyle: {
fontSize: legendSize
}
},
plotOptions: {
pie: {
/**
allowPointSelect: true,
cursor: 'pointer',
depth: 35,
dataLabels: {
enabled: true,
format: '{point.name}'
},
* */
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false,
},
showInLegend: true
}
},
series: [{
type: 'pie',
name: input['conso-ener']['yAxis_title'],
data: input['conso-ener']['data']
}]
});
// console.log(input['beges']['data']);
$('#beges-chart').highcharts({
colorAxis: {
// minColor: '#D9B1EF',
// minColor: '#FFBC75',
minColor: input["color_beges"][0],
// maxColor: '#AE69D3' //Highcharts.getOptions().colors[0]
// maxColor: '#EA9C4D'
maxColor: input["color_beges"][1]
},
credits: false,
series: [{
type: 'treemap',
layoutAlgorithm: 'squarified',
data: input['beges']['data'],
dataLabels: {
enabled: true,
style: {
textOutline: 'none',
fontSize: legendSize
}
}
}],
legend: {
enabled: false
},
tooltip: {
pointFormat: '{point.name} : {point.value} ' + input['beges']['yAxis_title'],
style: {
fontSize: tooltipSize
}
},
subtitle: {
text: input['beges']['yAxis_title'] + ' - ' + input['beges']['date_published'], // + ' ' + input['conso-ener']['negative_notice'],
style: {
fontSize: titleSize
}
},
title: {
//text: input['beges']['viz_title'] + ' ' + input['beges']['date_published']
text:null
}
});
$('#atmo-chart').highcharts({
chart: {
type: 'column'
},
credits: false,
title: {
// text: input['atmo']['viz_title'] + ' ' + input['atmo']['date_published']
text:null
},
xAxis: {
categories: input['atmo']['categories'],
labels: {enableHTML:true, style:{fontSize: legendSize}}
},
yAxis: {
min: 0,
title: {
text: input['atmo']['viz_title'] + ' - ' + input['atmo']['date_published'],
style: {
fontSize: legendSize
}
},
},
tooltip: {
pointFormat: '{series.name}: {point.y} ({point.percentage:.0f}%)
',
shared: true,
style: {
fontSize: tooltipSize
}
},
legend: {
itemStyle: {
fontSize: legendSize
}
},
plotOptions: {
column: {
stacking: 'percent'
}
},
series: input['atmo']['data']
/**
[{
name: 'John',
data: [5, 3, 4, 7, 2]
}, {
name: 'Jane',
data: [2, 2, 3, 2, 1]
}, {
name: 'Joe',
data: [3, 4, 4, 2, 5]
}]
*/
});
$('#elec-chart').highcharts({
chart: {
backgroundColor: $('#prod-container').css('background-color'),
plotBackgroundColor: null,
plotBorderWidth: 0,
plotShadow: false
},
credits: false,
title: {
text: input['enr-elec']['yAxis_title'],
align: 'center',
verticalAlign: 'middle',
y: 20,
style: {
fontSize: titleSize
}
},
tooltip: {
pointFormat: '{series.name} : {point.y} ({point.percentage:,.2f} %)',
style: {
fontSize: tooltipSize
}
},
legend: {
itemStyle: {
fontSize: legendSize
}
},
/**
plotOptions: {
pie: {
dataLabels: {
enabled: false, // set to true to display labels
distance: -50,
style: {
fontWeight: 'bold',
color: 'white',
textShadow: '0px 1px 2px black'
}
},
startAngle: -90,
endAngle: 90,
center: ['50%', '75%']
}
},
* */
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true,
startAngle: -90,
endAngle: 90,
center: ['50%', '75%']
}
},
series: [{
type: 'pie',
name: input['enr-elec']['yAxis_title'],
innerSize: '50%',
data: input['enr-elec']['data'],
}]
});
$('#chaleur-chart').highcharts({
chart: {
backgroundColor: $('#prod-container').css('background-color'),
plotBackgroundColor: null,
plotBorderWidth: 0,
plotShadow: false
},
credits: false,
title: {
text: input['enr-chal']['yAxis_title'],
align: 'center',
verticalAlign: 'middle',
y: 20,
style: {
fontSize: titleSize
}
},
tooltip: {
pointFormat: '{series.name} : {point.y} ({point.percentage:,.2f} %)',
style: {
fontSize: tooltipSize
}
},
legend: {
itemStyle: {
fontSize: legendSize
}
},
/**
plotOptions: {
pie: {
dataLabels: {
enabled: false, // set to true to display labels
distance: -50,
style: {
fontWeight: 'bold',
color: 'white',
textShadow: '0px 1px 2px black'
}
},
startAngle: -90,
endAngle: 90,
center: ['50%', '75%']
}
},
* */
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true,
startAngle: -90,
endAngle: 90,
center: ['50%', '75%']
}
},
series: [{
type: 'pie',
name: input['enr-chal']['yAxis_title'],
innerSize: '50%',
data: input['enr-chal']['data'],
}]
});
});