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

Bugfix: Auto resizing chart when window/parent container expands

parent 76a1f174
Branches
No related tags found
2 merge requests!13Saddlegallmidge form idec 372,!12feat: Add test page (spatial) with mapserver layer in openlayers map
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
<select class="form-control" name="weatherStationId" id="weatherStationId"></select> <select class="form-control" name="weatherStationId" id="weatherStationId"></select>
</div> </div>
<button class="btn btn-primary" type="button" onclick="submitData();">Submit</button> <button class="btn btn-primary" type="button" onclick="submitData();">Submit</button>
<div> <div style="aspect-ratio: 2;">
<canvas id="resultChart"></canvas> <canvas id="resultChart""></canvas>
</div> </div>
<div id="weatherData" class="table-responsive"> <div id="weatherData" class="table-responsive">
</div> </div>
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
// Page globals // Page globals
var modelMetaData = undefined; var modelMetaData = undefined;
var weatherDatasource = undefined; var weatherDatasource = undefined;
var weatherDatasources = undefined;
var editor = undefined; var editor = undefined;
const selectList = document.getElementById("weatherStationId"); const selectList = document.getElementById("weatherStationId");
...@@ -73,6 +74,8 @@ ...@@ -73,6 +74,8 @@
//console.info("Adding weather stations"); //console.info("Adding weather stations");
// Pull weather stations from web service, render list // Pull weather stations from web service, render list
weatherDatasource = await getWeatherDatasource("no.nibio.lmt"); weatherDatasource = await getWeatherDatasource("no.nibio.lmt");
weatherDatasources = await getWeatherDatasources();
console.info(weatherDatasources);
stationList = await getWeatherStationList(weatherDatasource); stationList = await getWeatherStationList(weatherDatasource);
stationList.sort((a, b) => { stationList.sort((a, b) => {
return (a.name < b.name) ? -1 : (a.name > b.name) ? 1 : 0; return (a.name < b.name) ? -1 : (a.name > b.name) ? 1 : 0;
...@@ -160,13 +163,14 @@ ...@@ -160,13 +163,14 @@
new Chart(ctx, { new Chart(ctx, {
type: "line", type: "line",
options: { options: {
responsive: true,
scales: { scales: {
x: { x: {
type: "time", type: "time",
time: { time: {
//unit: "day", //unit: "day",
diplayFormats: { diplayFormats: {
day: "YYYY-MM-DD" // This doesn't seem to have any effect day: "YYYY-MM-DD" // This doesn't seem to have any effect. Why??
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment