import {logerror} from "./logit.js"; import * as utils from "./chart_utilities.js"; import { DateTime } from './luxon.min.js' 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: 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"}, ] export async function showChart(params, typ, container) { function form() { for(let item of tabtable) { if (item.type === typ) { const d = DateTime.fromMillis(this.x, {zone: 'utc'}) const d1 = d.plus({days: 1}) let fmt = d.toFormat(item.dformat) if(((typ === 'daynight') && (this.series.name.startsWith('N'))) || (typ === 'lden')) { fmt = `${d.toFormat('dd')}/${d1.toFormat('dd.LL')}` } if(this.series.name === 'Peaks') { item.div = 0 } return '