var windv = document.getElementById('windc').getContext('2d');
var windkmh = document.getElementById('windkmh').getContext('2d');
var windms = document.getElementById('windms').getContext('2d');
var windknp = document.getElementById('windknp').getContext('2d');
var luchtdruk = document.getElementById('luchtdruk').getContext('2d');
var temperatuur = document.getElementById('temperatuur').getContext('2d');
var wolken = document.getElementById('bewolking').getContext('2d');
var mwolken = document.getElementById('mbewolking').getContext('2d');
var hwolken = document.getElementById('hbewolking').getContext('2d');
var neerslag = document.getElementById('neerslag').getContext('2d');
var straling = document.getElementById('straling').getContext('2d');
var zicht = document.getElementById('zicht').getContext('2d');
// $("#windr").html("test");
document.getElementById("windr").innerHTML="
























";
var gradient = windv.createLinearGradient(0, 0, 0, 400);
gradient.addColorStop(0, 'rgba(0,111,174,0.8)');
gradient.addColorStop(1, 'rgba(21,31,38,0.5)');
// Functie om min/max waarden te berekenen met 25% marge
function calculateYAxisRange(minValue, maxValue) {
const range = maxValue - minValue;
const margin = range * 0.25;
return {
min: Math.max(0, minValue - margin), // Nooit onder nul
max: maxValue + margin
};
}
var windChart = new Chart(windv, {
type: 'line',
data: {
labels: ["21","22","23","00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22"],
datasets: [{
label: 'wind',
data: [2,2,2,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,2,2,2,2,2,2,2,2],
backgroundColor: 'rgba(0,111,174,0.8)',
borderColor: 'rgba(0,111,174,1)',
borderWidth: 1,
fill: true
}]
},
options: {
plugins: {
legend: {
display: false
}
},
scales: {
y: {
...calculateYAxisRange(0, 4),
ticks: {
callback: function(value, index, ticks) {
return value + ' bft';
}
}
}
},
plugins: {
tooltip: {
enabled: true,
mode: 'index',
intersect: false,
callbacks: {
title: function(tooltipItems) {
return tooltipItems[0].label + ' uur';
},
label: function(tooltipItem) {
return tooltipItem.raw + ' bft';
}
}
}
}
}
});
var windknpChart = new Chart(windknp, {
type: 'line',
data: {
labels: ["21","22","23","00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22"],
datasets: [{
label: 'wind',
data: [6,4,4,2,0,2,0,2,2,2,2,4,2,2,2,2,2,2,4,4,4,4,4,6,6,4],
backgroundColor: 'rgba(0,111,174,0.8)',
borderColor: 'rgba(0,111,174,1)',
borderWidth: 1,
fill: true
}]
},
options: {
plugins: {
legend: {
display: false
}
},
scales: {
y: {
...calculateYAxisRange(0, 8),
ticks: {
callback: function(value, index, ticks) {
return value + ' knp';
}
}
}
},
plugins: {
tooltip: {
enabled: true,
mode: 'index',
intersect: false,
callbacks: {
title: function(tooltipItems) {
return tooltipItems[0].label + ' uur';
},
label: function(tooltipItem) {
return tooltipItem.raw + ' knp';
}
}
}
}
}
});
var windkmhChart = new Chart(windkmh, {
type: 'line',
data: {
labels: ["21","22","23","00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22"],
datasets: [{
label: 'wind',
data: [10.8,7.2,7.2,3.6,0,3.6,0,3.6,3.6,3.6,3.6,7.2,3.6,3.6,3.6,3.6,3.6,3.6,7.2,7.2,7.2,7.2,7.2,10.8,10.8,7.2],
backgroundColor: 'rgba(0,111,174,0.8)',
borderColor: 'rgba(0,111,174,1)',
borderWidth: 1,
fill: true
}]
},
options: {
plugins: {
legend: {
display: false
}
},
scales: {
y: {
...calculateYAxisRange(0, 12.8),
ticks: {
callback: function(value, index, ticks) {
return value + ' km/h';
}
}
}
},
plugins: {
tooltip: {
enabled: true,
mode: 'index',
intersect: false,
callbacks: {
title: function(tooltipItems) {
return tooltipItems[0].label + ' uur';
},
label: function(tooltipItem) {
return tooltipItem.raw + ' km/h';
}
}
}
}
}
});
var windmsChart = new Chart(windms, {
type: 'line',
data: {
labels: ["21","22","23","00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22"],
datasets: [{
label: 'wind',
data: [3,2,2,1,0,1,0,1,1,1,1,2,1,1,1,1,1,1,2,2,2,2,2,3,3,2],
backgroundColor: 'rgba(0,111,174,0.8)',
borderColor: 'rgba(0,111,174,1)',
borderWidth: 1,
fill: true
}]
},
options: {
plugins: {
legend: {
display: false
}
},
scales: {
y: {
...calculateYAxisRange(0, 5),
ticks: {
callback: function(value, index, ticks) {
return value + ' m/s';
}
}
}
},
plugins: {
tooltip: {
enabled: true,
mode: 'index',
intersect: false,
callbacks: {
title: function(tooltipItems) {
return tooltipItems[0].label + ' uur';
},
label: function(tooltipItem) {
return tooltipItem.raw + ' m/s';
}
}
}
}
}
});
var luchtdChart = new Chart(luchtdruk, {
type: 'line',
data: {
labels: ["21","22","23","00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22"],
datasets: [{
label: 'luchtdruk',
data: [1016.5,1016.7,1016.8,1016.7,1016.6,1016.4,1016.2,1015.9,1015.8,1015.9,1016,1016.2,1016.2,1016.1,1015.9,1015.6,1015.3,1014.9,1014.5,1014,1013.5,1013.1,1013.1,1013.1,1013.2,1013.2],
backgroundColor: 'rgba(0,111,174,0.8)',
borderColor: 'rgba(0,111,174,1)',
borderWidth: 1,
fill: true
}]
},
options: {
plugins: {
legend: {
display: false
}
},
scales: {
y: {
...calculateYAxisRange(1008, 1022),
ticks: {
callback: function(value, index, ticks) {
return value + ' hPa';
}
}
}
},
plugins: {
tooltip: {
enabled: true,
mode: 'index',
intersect: false,
callbacks: {
title: function(tooltipItems) {
return tooltipItems[0].label + ' uur';
},
label: function(tooltipItem) {
return tooltipItem.raw + ' hPa';
}
}
}
}
}
});
var tempChart = new Chart(temperatuur, {
type: 'line',
data: {
labels: ["21","22","23","00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22"],
datasets: [{
label: 'temperatuur',
data: [22,21,20,19,18,17,16,15,15,15,16,17,19,20,21,22,23,24,25,26,26,26,26,25,24,23],
backgroundColor: 'rgba(0,111,174,0.8)',
borderColor: 'rgba(0,111,174,1)',
borderWidth: 1,
fill: true
}]
},
options: {
plugins: {
legend: {
display: false
}
},
scales: {
y: {
...calculateYAxisRange(14, 28),
ticks: {
callback: function(value, index, ticks) {
return value + ' ºC';
}
}
}
},
plugins: {
tooltip: {
enabled: true,
mode: 'index',
intersect: false,
callbacks: {
title: function(tooltipItems) {
return tooltipItems[0].label + ' uur';
},
label: function(tooltipItem) {
return tooltipItem.raw + ' ºC';
}
}
}
}
}
});
var wolkenChart = new Chart(wolken, {
type: 'bar',
data: {
labels: ["21","22","23","00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22"],
datasets: [{
label: 'wolken',
data: [0,0,0,0,2,0,3,1,7,55,99,7,97,100,85,1,1,15,43,55,20,35,76,0,0,0],
backgroundColor: 'rgba(0,111,174,0.8)',
borderColor: 'rgba(0,111,174,1)',
borderWidth: 1
}]
},
options: {
plugins: {
legend: {
display: false
}
},
scales: {
y: {
beginAtZero: true,
ticks: {
callback: function(value, index, ticks) {
return value + ' %';
}
}
}
},
plugins: {
tooltip: {
enabled: true,
mode: 'index',
intersect: false,
callbacks: {
title: function(tooltipItems) {
return tooltipItems[0].label + ' uur';
},
label: function(tooltipItem) {
return tooltipItem.raw + ' %';
}
}
}
}
}
});
var mwolkenChart = new Chart(mwolken, {
type: 'bar',
data: {
labels: ["21","22","23","00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22"],
datasets: [{
label: 'wolken',
data: [0,0,0,0,0,0,0,0,0,0,0,0,58,100,99,0,3,83,1,2,0,0,0,0,0,0],
backgroundColor: 'rgba(0,111,174,0.8)',
borderColor: 'rgba(0,111,174,1)',
borderWidth: 1
}]
},
options: {
plugins: {
legend: {
display: false
}
},
scales: {
y: {
beginAtZero: true,
ticks: {
callback: function(value, index, ticks) {
return value + ' %';
}
}
}
},
plugins: {
tooltip: {
enabled: true,
mode: 'index',
intersect: false,
callbacks: {
title: function(tooltipItems) {
return tooltipItems[0].label + ' uur';
},
label: function(tooltipItem) {
return tooltipItem.raw + ' %';
}
}
}
}
}
});
var hwolkenChart = new Chart(hwolken, {
type: 'bar',
data: {
labels: ["21","22","23","00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22"],
datasets: [{
label: 'wolken',
data: [1,0,5,0,1,0,0,99,100,100,100,100,100,92,91,100,100,100,100,94,38,12,0,0,7,4],
backgroundColor: 'rgba(0,111,174,0.8)',
borderColor: 'rgba(0,111,174,1)',
borderWidth: 1
}]
},
options: {
plugins: {
legend: {
display: false
}
},
scales: {
y: {
beginAtZero: true,
ticks: {
callback: function(value, index, ticks) {
return value + ' %';
}
}
}
},
plugins: {
tooltip: {
enabled: true,
mode: 'index',
intersect: false,
callbacks: {
title: function(tooltipItems) {
return tooltipItems[0].label + ' uur';
},
label: function(tooltipItem) {
return tooltipItem.raw + ' %';
}
}
}
}
}
});
var neerslagChart = new Chart(neerslag, {
type: 'bar',
data: {
labels: ["21","22","23","00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22"],
datasets: [{
label: 'neerslag',
data: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
backgroundColor: 'rgba(0,111,174,0.8)',
borderColor: 'rgba(0,111,174,1)',
borderWidth: 1
}]
},
options: {
plugins: {
legend: {
display: false
}
},
scales: {
y: {
...calculateYAxisRange(0, 2),
ticks: {
callback: function(value, index, ticks) {
return value + ' mm';
}
}
}
},
plugins: {
tooltip: {
enabled: true,
mode: 'index',
intersect: false,
callbacks: {
title: function(tooltipItems) {
return tooltipItems[0].label + ' uur';
},
label: function(tooltipItem) {
return tooltipItem.raw + ' mm';
}
}
}
}
}
});
var stralingChart = new Chart(straling, {
type: 'bar',
data: {
labels: ["21","22","23","00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22"],
datasets: [{
label: 'Global radiation',
data: [4,0,0,0,0,0,0,0,1,15,40,61,124,86,49,184,202,214,180,133,161,124,76,23,5,0],
backgroundColor: 'rgba(0,111,174,0.8)',
borderColor: 'rgba(0,111,174,1)',
borderWidth: 1
}]
},
options: {
plugins: {
legend: {
display: false
}
},
scales: {
y: {
...calculateYAxisRange(0, 219),
ticks: {
callback: function(value, index, ticks) {
return value + ' W/m2';
}
}
}
},
plugins: {
tooltip: {
enabled: true,
mode: 'index',
intersect: false,
callbacks: {
title: function(tooltipItems) {
return tooltipItems[0].label + ' uur';
},
label: function(tooltipItem) {
return tooltipItem.raw + ' W/m2';
}
}
}
}
}
});
var zichtChart = new Chart(zicht, {
type: 'line',
data: {
labels: ["21","22","23","00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22"],
datasets: [{
label: 'zicht',
data: [25979,22652,19382,16120,14163,13099,12524,11733,11076,12879,14960,15724,19689,23327,25253,27591,29220,30139,30944,30629,30662,30278,29579,27898,26009,24426],
backgroundColor: 'rgba(0,111,174,0.8)',
borderColor: 'rgba(0,111,174,1)',
borderWidth: 1,
fill: true
}]
},
options: {
plugins: {
legend: {
display: false
}
},
scales: {
y: {
min: 0,
max: 55000,
ticks: {
callback: function(value, index, ticks) {
return value + ' m';
}
}
}
},
plugins: {
tooltip: {
enabled: true,
mode: 'index',
intersect: false,
callbacks: {
title: function(tooltipItems) {
return tooltipItems[0].label + ' uur';
},
label: function(tooltipItem) {
return tooltipItem.raw + ' m';
}
}
}
}
}
});