*** WIP WIP *** All charts work now

This commit is contained in:
rxf
2023-04-02 15:34:49 +02:00
parent a1c1c93bc4
commit 5082eb408f
5 changed files with 25 additions and 12 deletions
+15 -8
View File
@@ -6,11 +6,11 @@ import * as map from "./map.js";
// table to distribute the different charts
export const tabtable = [
{id: 'kartentab', type: 'map', container: 'map', func: map.showMap, div: null, dformat: null},
{id: 'livetab', type: 'live', container: 'dlive', func: showChart, div: 100, dformat: "dd.LL - HH:mm:ss"},
{id: 'houravgtab', type: 'havg', container: 'dhour', func: showChart, div: 10, dformat: "dd.LL - HH'h'"},
{id: 'dayavgtab', type: 'davg', container: 'dday', func: showChart, div: 10, dformat: "dd.LL"},
{id: 'daynighttab', type: 'daynight', container: 'ddaynight', func: showChart, div: 10, dformat: "dd.LL"},
{id: 'ldentab', type: 'lden', container: 'dlden', func: showChart, div: 10, dformat: "dd.LL"},
{id: 'livetab', type: 'live', container: 'dlive', func: showChart, div: 2, dformat: "dd.LL - HH:mm:ss"},
{id: 'houravgtab', type: 'havg', container: 'dhour', func: showChart, div: 1, dformat: "dd.LL - HH'h'"},
{id: 'dayavgtab', type: 'davg', container: 'dday', func: showChart, div: 1, dformat: "dd.LL"},
{id: 'daynighttab', type: 'daynight', container: 'ddaynight', func: showChart, div: 1, dformat: "dd.LL"},
{id: 'ldentab', type: 'lden', container: 'dlden', func: showChart, div: 1, dformat: "dd.LL"},
]
@@ -24,11 +24,15 @@ export async function showChart(params, typ, container) {
if(((typ === 'daynight') && (this.series.name.startsWith('N'))) || (typ === 'lden')) {
fmt = `${d.toFormat('dd')}/${d1.toFormat('dd.LL')}`
}
let y = Math.round(this.y * item.div) / item.div
if(this.series.name === 'Peaks') {
item.div = 0
}
return '<div style="border: 2px solid ' + this.point.color + '; padding: 3px;">' +
fmt + '<br />' +
'<span style="color: ' + this.point.color + '">&#9679;&nbsp;</span>' +
this.series.name + ':&nbsp; <b>' + y + '</b></div>'
this.series.name + ':&nbsp; <b>' +
Highcharts.numberFormat(this.y,item.div) +
'</b></div>'
}
}
}
@@ -62,7 +66,10 @@ export async function showChart(params, typ, container) {
erg.options.xAxis.labels.formatter = xformat
erg.options.tooltip.formatter = form
let chr = Highcharts.chart(container, erg.options, function (chart) {
utils.addSensorID2chart(chart, {sid: erg.params.sensorid, indoor: erg.params.indoor}, document.getElementById(container).offsetWidth)
utils.addSensorID2chart(chart, {
sid: erg.params.sensorid,
indoor: erg.params.indoor
}, document.getElementById(container).offsetWidth)
})
if((typ === 'havg') || (typ === 'davg')) {