Fix chart reload bug #47
1 changed files with 11 additions and 0 deletions
|
@ -171,6 +171,15 @@
|
|||
});
|
||||
}
|
||||
|
||||
function destroyCharts(container) {
|
||||
container.querySelectorAll('canvas').forEach(c => {
|
||||
const chart = Chart.getChart(c);
|
||||
if (chart) {
|
||||
chart.destroy();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadReports() {
|
||||
let path;
|
||||
let container;
|
||||
|
@ -183,6 +192,7 @@
|
|||
} else {
|
||||
container = containers.domain;
|
||||
if (!currentDomain) {
|
||||
destroyCharts(container);
|
||||
container.innerHTML = '<p>Select a domain</p>';
|
||||
return;
|
||||
}
|
||||
|
@ -192,6 +202,7 @@
|
|||
fetch(path + '/reports.json')
|
||||
.then(r => r.json())
|
||||
.then(reports => {
|
||||
destroyCharts(container);
|
||||
container.innerHTML = '';
|
||||
reports.forEach(rep => {
|
||||
fetch(path + '/' + rep.html)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue