*** WIP WIP *** load all charts in advance

This commit is contained in:
rxf
2023-04-04 10:39:13 +02:00
parent 5082eb408f
commit 71a59fb9e8
6 changed files with 56 additions and 58 deletions
+14 -21
View File
@@ -10,7 +10,7 @@ import * as chart_dayavg from './chart_dayavg.js'
import * as chart_daynight from './chart_daynight.js'
import * as chart_lden from './chart_lden.js'
import * as utils from "./chart_utilities.js";
import {tabtable} from './showcharts.js'
import { tabtable, loadAll } from './showcharts.js'
(async () => {
@@ -22,29 +22,19 @@ import {tabtable} from './showcharts.js'
// global variables
let params = { // set defaults
drawlines: false,
nbrentries: 0,
device: '',
coordinates: false,
center: Stuttgart,
zoom: 10,
refresh: 0,
starttime: '2023-01-01T00:00:00Z', //date2ISO(defaultStartime),
endtime: '2023-03-01T00:00:00Z' //date2ISO(emptyTimes.emptyHMtime)
}
let status = {
loaded: false
}
// END global variables
// remove the taps (if shownig the map)
const removeTabs = () => {
document.querySelector('#navi').style.display = 'none'
}
// show thw tabs again
const showTabs = () => {
document.querySelector('#navi').style.display = 'block'
}
// main function:
// show the map if calle w/o any parameter
// if called with a sensor-ID, show the live chart for this sensor
@@ -57,12 +47,14 @@ import {tabtable} from './showcharts.js'
triggerEl.addEventListener('click', function (event) {
event.preventDefault()
tabTrigger.show()
for(let x of tabtable) {
if (x.id === event.currentTarget.id) {
x.func(params, x.type, x.container)
if((!status.loaded) || (this.id === 'kartentab')) {
for (let x of tabtable) {
if (x.id === event.currentTarget.id) {
x.func(params, x.type, x.container)
}
}
logit(`tab changed to ${event.currentTarget.id}`)
}
logit(`tab chaned to ${event.currentTarget.id}`)
})
})
@@ -80,10 +72,11 @@ import {tabtable} from './showcharts.js'
params.sid = csid
await chart_live.showLive(params)
}
// show the map
removeTabs()
map.showMap(params)
map.showMap(params, status)
}
main().catch(console.error)
})()