This commit is contained in:
Louis Croisez
2023-05-16 23:34:42 +02:00
parent 04dae073f6
commit 38e60f23be
+3
View File
@@ -506,6 +506,7 @@ function generateMiniGraph(elem, comname) {
// Create a div element for the chart window // Create a div element for the chart window
if (typeof(window.chartWindow) != 'undefined') { if (typeof(window.chartWindow) != 'undefined') {
document.body.removeChild(window.chartWindow); document.body.removeChild(window.chartWindow);
window.chartWindow = undefined;
} }
var chartWindow = document.createElement('div'); var chartWindow = document.createElement('div');
chartWindow.className = "chartdiv" chartWindow.className = "chartdiv"
@@ -615,6 +616,7 @@ function generateMiniGraph(elem, comname) {
closeButton.style.right = '5px'; closeButton.style.right = '5px';
closeButton.addEventListener('click', function() { closeButton.addEventListener('click', function() {
document.body.removeChild(chartWindow); document.body.removeChild(chartWindow);
window.chartWindow = undefined;
}); });
chartWindow.appendChild(closeButton); chartWindow.appendChild(closeButton);
window.chartWindow = chartWindow; window.chartWindow = chartWindow;
@@ -631,6 +633,7 @@ window.addEventListener('scroll', function() {
// Loop through all chart elements and remove them // Loop through all chart elements and remove them
charts.forEach(function(chart) { charts.forEach(function(chart) {
chart.parentNode.removeChild(chart); chart.parentNode.removeChild(chart);
window.chartWindow = undefined;
}); });
}); });