Settings added
public/chart_utilities.js
- showError with id
public/javascripts/global.js
- save parameter fron settings
views/index.pug
- add settings dialog
views/layout.pug
- add flatpicker
public/javascripts/map.js
- add error evaluation
public/javascripts/showcharts.js
- error avelauation added
public/stylesheets/style.sass
- add styles for settings dialog
This commit is contained in:
@@ -2,6 +2,7 @@ import {logerror} from "./logit.js";
|
||||
import * as utils from "./chart_utilities.js";
|
||||
import { DateTime } from './luxon.min.js'
|
||||
import * as map from "./map.js";
|
||||
import {showError} from "./chart_utilities.js";
|
||||
|
||||
// table to distribute the different charts
|
||||
export const tabtable = [
|
||||
@@ -55,25 +56,34 @@ export async function showChart(params, typ, container) {
|
||||
}
|
||||
}
|
||||
|
||||
const url = `/chart/getsensordata?sensorid=${params.sid}&data=${typ}`
|
||||
const url = `/chart/getsensordata?sensorid=${params.sid}&data=${typ}&span=${params.span}&datetime=${params.datetime.slice(0,-10)}&peak=${params.peak}`
|
||||
let ret = await fetch(url)
|
||||
.catch(e => {
|
||||
logerror(e)
|
||||
});
|
||||
let erg = await ret.json()
|
||||
erg.options.xAxis.labels.formatter = xformat
|
||||
erg.options.tooltip.formatter = form
|
||||
let chart = Highcharts.chart(container, erg.options, function (chart) {
|
||||
utils.addSensorID2chart(chart, {
|
||||
sid: erg.params.sensorid,
|
||||
indoor: erg.params.indoor
|
||||
}, document.getElementById(container).offsetWidth)
|
||||
})
|
||||
if (!erg.err) {
|
||||
erg.options.xAxis.labels.formatter = xformat
|
||||
erg.options.tooltip.formatter = form
|
||||
let chart = Highcharts.chart(container, erg.options, function (chart) {
|
||||
utils.addSensorID2chart(chart, {
|
||||
sid: erg.params.sensorid,
|
||||
indoor: erg.params.indoor
|
||||
}, document.getElementById(container).offsetWidth)
|
||||
})
|
||||
return true
|
||||
} else {
|
||||
showError(erg.err)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export const loadAll = async (params) => {
|
||||
console.log('now load all in Background')
|
||||
for (let i = 2; i < tabtable.length; i++) {
|
||||
await showChart(params, tabtable[i].type, tabtable[i].container)
|
||||
let ok = await showChart(params, tabtable[i].type, tabtable[i].container)
|
||||
if (!ok) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user