var chart;
Highcharts.setOptions({
lang: {
months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin',
'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
shortMonths: ['Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Juin',
'Juil', 'Août', 'Sept', 'Oct', 'Nov', 'Déc'],
weekdays: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
thousandsSep: ''
}
});
var chaud = (function () { // Ecc+Ecs
// define the options
var options = {
chart : {
renderTo : 'container',
type : 'line'
},
credits : {
enabled : false
},
title : {
text : 'Chaudière'
},
subtitle : {
text : 'Cumul journalier (kW)'
},
xAxis : {
type : 'datetime',
maxPadding : 0.005,
minPadding : 0.005,
labels : {
align : 'left'
},
dateTimeLabelFormats : {
day : '%e %b',
week : '%e %b %y',
month : '%b %y',
year : '%Y'
}
},
yAxis : [
{ // left y axis
min: 0,
//max: 100,
//minRange: 40,
title : {
text : 'Ecc'
},
gridLineWidth : 0,
labels : {
align : 'right',
x : -5,
formatter : function () {
return Highcharts.numberFormat(this.value, 0);
}
}
}
],
legend : {
align : 'left',
verticalAlign : 'top',
y : 20,
floating : true,
borderWidth : 0
},
tooltip : {
xDateFormat: '%A %d %B %Y',
valueSuffix : 'kW'
},
plotOptions : {
series : {
pointInterval : 24 * 3600 * 1000,
marker : {
enabled : false
}
}
},
series : [
{
name : 'Ecc+Ecs '
}
]
};
var update = function (months) {
try {
chart.showLoading();
} catch (e) {}
$.ajax({
url : 'historicChaudDaily.php?months=' + months,
datatype : "json",
success : function (resp) {
options.chart.type = months > 6 ? 'area' : 'column';
options.series[0].pointStart = resp[0];
options.series[0].data = resp[1];
chart = new Highcharts.Chart(options);
}
}); // end ajax()
};
return {
update : update
};
}());
var chaudYr = (function () { // Ecc+Ecs
// define the options
var options = {
chart : {
renderTo : 'container',
zoomType: 'x'
},
credits : {
enabled : false
},
title : {
text : 'Chaudière'
},
subtitle : {
text : 'Cumul journalier (kW)'
},
xAxis : {
categories : [
'Jan',
'Fév',
'Mars',
'Avr',
'Mai',
'Juin',
'Juil',
'Août',
'Sep',
'Oct',
'Nov',
'Déc'
]
},
yAxis : [
{ // left y axis
min: 0,
//max: 100,
//minRange: 40,
title : {
text : 'kW'
},
gridLineWidth : 0,
labels : {
align : 'right',
x : -5,
formatter : function () {
return Highcharts.numberFormat(this.value, 0);
}
}
}
],
legend : {
align : 'left',
verticalAlign : 'top',
y : 20,
floating : true,
borderWidth : 0
},
tooltip : {
crosshairs : true,
shared : true,
formatter: function() {
var s = this.x;
$.each(this.points, function(i, point) {
s += '
'+ point.series.name +'' +': '+ point.y+'kW';
});
return s;
}
},
plotOptions : {
column : {
groupPadding : 0.1,
pointPadding : 0.1,
borderWidth : 0
}
},
series : [{}]
};
var update = function () {
try {
chart.showLoading();
} catch (e) {}
$.ajax({
url : 'historicChaudYearly.php',
datatype : "json",
success : function (resp) {
var i = 0,
m = 0,
y, tmp, j,
avg = [];
// create some progresive shading for the columns
for (; i < resp[0].length; i++) {
options.series[i] = {
type : 'column',
name : resp[0][i],
data : resp[1][i],
color : 'rgb(' + (10 + i * 20) + ',' + (140 - i * 20) + ',' + (200 - i * 20) + ')'
};
}
chart = new Highcharts.Chart(options);
}
}); // end ajax()
};
return {
update : update
};
}());
var chaud1 = (function () { // Ecc Ecs
// define the options
var options = {
chart : {
renderTo : 'container',
type : 'line'
},
credits : {
enabled : false
},
title : {
text : 'Chaudière'
},
subtitle : {
text : 'Cumul journalier (kW)'
},
xAxis : {
type : 'datetime',
maxPadding : 0.005,
minPadding : 0.005,
labels : {
align : 'left'
},
dateTimeLabelFormats : {
day : '%e %b',
week : '%e %b %y',
month : '%b %y',
year : '%Y'
}
},
yAxis : [
{ // left y axis
min: 0,
//max: 100,
//minRange: 40,
title : {
text : 'Ecc'
},
gridLineWidth : 0,
labels : {
align : 'right',
x : -5,
formatter : function () {
return Highcharts.numberFormat(this.value, 0);
}
}
}, { // right y axis
min : 0,
gridLineWidth : 0,
opposite : true,
title : {
text : 'Ecs'
},
labels : {
align : 'left',
x : 5,
formatter : function () {
return Highcharts.numberFormat(this.value, 0);
}
},
}
],
legend : {
align : 'left',
verticalAlign : 'top',
y : 20,
floating : true,
borderWidth : 0
},
tooltip : {
xDateFormat: '%A %d %B %Y',
valueSuffix : 'kW'
},
plotOptions : {
series : {
pointInterval : 24 * 3600 * 1000,
marker : {
enabled : false
}
}
},
series : [
{
name : 'Ecc '
},
{
name : 'Ecs ',
yAxis : 1
}
]
};
var update = function (months) {
try {
chart.showLoading();
} catch (e) {}
$.ajax({
url : 'historicChaudDaily.php?months=' + months,
datatype : "json",
success : function (resp) {
options.chart.type = months > 6 ? 'area' : 'column';
options.series[0].pointStart = resp[0];
options.series[0].data = resp[2];
options.series[1].pointStart = resp[0];
options.series[1].data = resp[3];
chart = new Highcharts.Chart(options);
}
}); // end ajax()
};
return {
update : update
};
}());
var chaud2 = (function () { // Ecc Ecs Elec Fioul
// define the options
var options = {
chart : {
renderTo : 'container',
type : 'line'
},
credits : {
enabled : false
},
title : {
text : 'Chaudière'
},
subtitle : {
text : 'Cumul journalier (kW)'
},
xAxis : {
type : 'datetime',
maxPadding : 0.005,
minPadding : 0.005,
labels : {
align : 'left'
},
dateTimeLabelFormats : {
day : '%e %b',
week : '%e %b %y',
month : '%b %y',
year : '%Y'
}
},
yAxis : [
{ // left y axis
min: 0,
//max: 100,
//minRange: 40,
title : {
text : 'Ecc'
},
gridLineWidth : 0,
labels : {
align : 'right',
x : -5,
formatter : function () {
return Highcharts.numberFormat(this.value, 0);
}
}
}, { // right y axis
min : 0,
gridLineWidth : 0,
opposite : true,
title : {
text : 'Ecs'
},
labels : {
align : 'left',
x : 5,
formatter : function () {
return Highcharts.numberFormat(this.value, 0);
}
},
}
],
legend : {
align : 'left',
verticalAlign : 'top',
y : 20,
floating : true,
borderWidth : 0
},
tooltip : {
xDateFormat: '%A %d %B %Y',
valueSuffix : 'kW'
},
plotOptions : {
series : {
pointInterval : 24 * 3600 * 1000,
stacking: 'normal',
marker : {
enabled : false
}
}
},
series : [
{
name : 'Ecc Fioul'
},
{
name : 'Ecc Elec'
//yaxis : 1,
},
{
name : 'Ecs Fioul',
yAxis : 1
},
{
name : 'Ecs Elec',
yAxis : 1
}
]
};
var update = function (months) {
try {
chart.showLoading();
} catch (e) {}
$.ajax({
url : 'historicChaudDaily.php?months=' + months,
datatype : "json",
success : function (resp) {
options.series[0].pointStart = resp[0];
options.series[0].data = resp[1];
options.series[1].pointStart = resp[0];
options.series[1].data = resp[2];
options.series[2].pointStart = resp[0];
options.series[2].data = resp[3];
options.series[3].pointStart = resp[0];
options.series[3].data = resp[4];
chart = new Highcharts.Chart(options);
}
}); // end ajax()
};
return {
update : update
};
}());
var dju = (function () {
// define the options
var options = {
chart : {
renderTo : 'container',
type : 'column'
},
credits : {
enabled : false
},
title : {
text : 'Historique jours de chauffage'
},
subtitle : {
text : 'Déficit degrés jours (°C)'
},
xAxis : {
type : 'datetime',
dateTimeLabelFormats : {
day : '%e %b',
week : '%e %b %y',
month : '%b %y',
year : '%Y'
},
gridLineWidth : 0,
minorGridLineWidth : 0
},
yAxis : [
{ // left y axis
//min: 0,
title : {
text : null
},
labels : {
align : 'right',
x : -5,
formatter : function () {
return Highcharts.numberFormat(this.value, 1);
}
}
}
],
legend : {
enabled : false
},
tooltip : {
xDateFormat: '%A %d %B %Y',
valueSuffix : " °C"
},
plotOptions : {
column : {
//pointPadding : 0.05,
borderWidth : 0,
cropThreshold : 500,
minPointLength : 2,
//groupPadding : 0.1
}
},
series : [
{
name : 'Dju-',
color : 'red',
pointInterval : 24 * 3600 * 1000
}
]
};
var update = function (months) {
try {
chart.showLoading();
} catch (e) {}
$.ajax({
url : 'historicDjuDaily.php?months=' + months,
datatype : "json",
success : function (resp) {
options.series[0].pointStart = resp[0];
options.series[0].data = resp[1];
chart = new Highcharts.Chart(options);
}
}); // end ajax()
};
return {
update : update
};
}());
var djuYr = (function () {
// define the options
var options = {
chart : {
renderTo : 'container',
zoomType: 'x'
},
credits : {
enabled : false
},
title : {
text : 'Historique jours de chauffage'
},
subtitle : {
text : 'Déficit degrés jours (°C)'
},
xAxis : {
categories : [
'Jan',
'Fév',
'Mars',
'Avr',
'Mai',
'Juin',
'Juil',
'Août',
'Sep',
'Oct',
'Nov',
'Déc'
]
},
yAxis : [
{ // left y axis
min: 0,
//max: 100,
//minRange: 40,
title : {
text : '°C'
},
gridLineWidth : 0,
labels : {
align : 'right',
x : -5,
formatter : function () {
return Highcharts.numberFormat(this.value, 0);
}
}
}
],
legend : {
align : 'left',
verticalAlign : 'top',
y : 20,
floating : true,
borderWidth : 0
},
tooltip : {
crosshairs : true,
shared : true,
formatter: function() {
var s = this.x;
$.each(this.points, function(i, point) {
s += '
'+ point.series.name +'' +': '+ point.y+'°C';
});
return s;
}
},
plotOptions : {
column : {
groupPadding : 0.1,
pointPadding : 0.1,
borderWidth : 0
}
},
series : [{}]
};
var update = function () {
try {
chart.showLoading();
} catch (e) {}
$.ajax({
url : 'historicDjuYearly.php',
datatype : "json",
success : function (resp) {
var i = 0,
m = 0,
y, tmp, j,
avg = [];
// create some progresive shading for the columns
for (; i < resp[0].length; i++) {
options.series[i] = {
type : 'column',
name : resp[0][i],
data : resp[1][i],
color : 'rgb(' + (255 - i * 20) + ',' + (100 - i * 20) + ',' + (100 - i * 20) + ')'
};
}
chart = new Highcharts.Chart(options);
}
}); // end ajax()
};
return {
update : update
};
}());
var tps = (function () {
// define the options
var options = {
chart : {
renderTo : 'container',
zoomType: 'x',
type : 'column'
},
credits : {
enabled : false
},
title : {
text : 'Historique temps de marche chaudières'
},
subtitle : {
text : 'Tps de marche (h)'
},
xAxis : {
type : 'datetime',
dateTimeLabelFormats : {
day : '%e %b',
week : '%e %b %y',
month : '%b %y',
year : '%Y'
},
gridLineWidth : 0,
minorGridLineWidth : 0
},
yAxis : [
{ // left y axis
//min: 0,
title : {
text : null
},
labels : {
align : 'right',
x : -5,
formatter : function () {
return Highcharts.numberFormat(this.value, 1);
}
}
}
],
legend : {
enabled : false
},
tooltip : {
xDateFormat: '%A %d %B %Y',
valueSuffix : " h"
},
plotOptions : {
column : {
//pointPadding : 0.05,
borderWidth : 0,
cropThreshold : 500,
minPointLength : 2,
//groupPadding : 0.1
}
},
series : [
{
name : 'chaud',
color : 'green',
pointInterval : 24 * 3600 * 1000
}
]
};
var update = function (months) {
try {
chart.showLoading();
} catch (e) {}
$.ajax({
url : 'historicTpsDaily.php?months=' + months,
datatype : "json",
success : function (resp) {
options.series[0].pointStart = resp[0];
options.series[0].data = resp[1];
chart = new Highcharts.Chart(options);
}
}); // end ajax()
};
return {
update : update
};
}());
var edf = (function () {
// define the options
var options = {
chart : {
renderTo : 'container',
zoomType: 'x',
type : 'column'
},
credits : {
enabled : false
},
title : {
text : 'Historique conso EDF'
},
subtitle : {
text : 'Cumul journalier (kW)'
},
xAxis : {
type : 'datetime',
dateTimeLabelFormats : {
day : '%e %b',
week : '%e %b %y',
month : '%b %y',
year : '%Y'
},
gridLineWidth : 0,
minorGridLineWidth : 0
},
yAxis : [
{ // left y axis
//min: 0,
title : {
text : null
},
labels : {
align : 'right',
x : -5,
formatter : function () {
return Highcharts.numberFormat(this.value, 1);
}
}
}
],
legend : {
enabled : false
},
tooltip : {
xDateFormat: '%A %d %B %Y',
valueSuffix : " kW"
},
plotOptions : {
column : {
//pointPadding : 0.05,
borderWidth : 0,
cropThreshold : 500,
minPointLength : 2,
//groupPadding : 0.1
}
},
series : [
{
name : 'Edf',
color : 'orange',
pointInterval : 24 * 3600 * 1000
},
{
name : 'PM',
color : 'red',
pointInterval : 24 * 3600 * 1000
}
]
};
var update = function (months,opt) {
try {
chart.showLoading();
} catch (e) {}
$.ajax({
url : 'historicEdfDaily.php?months=' + months,
datatype : "json",
success : function (resp) {
/*switch (opt)
{
case 0:
options.subtitle.text = 'Hors chauffe1 (kW)';
break;
case 1:
options.subtitle.text = 'Heures normales (kW)';
break;
case 2:
options.subtitle.text = 'Pointes mobiles (kW)';
break;
}*/
options.subtitle.text = opt == 0 ? 'Hors chauffe (kW)' : 'HN+PM (kW)';
options.series[0].pointStart = resp[0];
options.series[0].data = resp[parseInt(opt)+1];
if (opt == 1){
options.series[1].pointStart = resp[0];
options.series[1].data = resp[parseInt(opt)+2];
}
chart = new Highcharts.Chart(options);
}
}); // end ajax()
};
return {
update : update
};
}());