Skip to content
Snippets Groups Projects
Commit b4c5b687 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Recreate chart on subsequent model runs

parent 03a5863b
No related branches found
No related tags found
2 merge requests!16Recreate chart on subsequent model runs,!12feat: Add test page (spatial) with mapserver layer in openlayers map
This commit is part of merge request !16. Comments created here will be created in the context of that merge request.
...@@ -99,6 +99,9 @@ ...@@ -99,6 +99,9 @@
var selectList = document.getElementById("weatherStationId"); var selectList = document.getElementById("weatherStationId");
var weatherData = undefined; var weatherData = undefined;
// Object that will hold the chart. Must be destroyed and recreated if you run the model more than once
let resultChart = undefined;
async function initPage() { async function initPage() {
currentModelMetaData = await getModelMetadata("adas.dss","HAPDMA"); currentModelMetaData = await getModelMetadata("adas.dss","HAPDMA");
...@@ -505,7 +508,11 @@ ...@@ -505,7 +508,11 @@
const ctx = document.getElementById('resultChart'); const ctx = document.getElementById('resultChart');
new Chart(ctx, { if(resultChart !== undefined)
{
resultChart.destroy();
}
resultChart = new Chart(ctx, {
type: "line", type: "line",
options: { options: {
responsive: true, responsive: true,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment