From 4918e6df474bd5f99ef67f7248d5fbf1e8c2f7ce Mon Sep 17 00:00:00 2001 From: rxf Date: Thu, 6 Apr 2023 17:25:12 +0200 Subject: [PATCH] deleted unneceesary files and references --- public/javascripts/chart_dayavg.js | 134 ---------------------- public/javascripts/chart_daynight.js | 160 --------------------------- public/javascripts/chart_houravg.js | 129 --------------------- public/javascripts/chart_lden.js | 112 ------------------- public/javascripts/chart_live.js | 68 ------------ public/javascripts/global.js | 6 - public/javascripts/map.js | 1 - 7 files changed, 610 deletions(-) delete mode 100644 public/javascripts/chart_dayavg.js delete mode 100644 public/javascripts/chart_daynight.js delete mode 100644 public/javascripts/chart_houravg.js delete mode 100644 public/javascripts/chart_lden.js delete mode 100644 public/javascripts/chart_live.js diff --git a/public/javascripts/chart_dayavg.js b/public/javascripts/chart_dayavg.js deleted file mode 100644 index e8056a0..0000000 --- a/public/javascripts/chart_dayavg.js +++ /dev/null @@ -1,134 +0,0 @@ -// Sh0w the hour average chart -import {logit, logerror} from './logit.js' -import * as utils from './chart_utilities.js' -import {DateTime, Duration} from "./luxon.min.js" - -// ****************************************************************** -// PlotDayAVG_Noise -// ****************************************************************** - - -export const showDayavg = async (params) => { - await PlotDayAVG_Noise(params.sid) -} - - -const PlotDayAVG_Noise = async function (sid) { - - let series1 = [] - let series2 = [] - - // read the data from the server - const url = `${utils.url}/getsensordata?sensorid=${sid}&data=davg` - let ret = await fetch(url) - .catch(e => { - logerror(e) - }) - let data = await ret.json() - if(!data.err) { - // Put values into the serieses - let cnt = 0 - data.values.forEach((x) => { - if(x.n_AVG != -1) { - let dat = new Date(x.datetime).getTime() // retrieve the date - series1.push([dat, x.n_AVG]) - series2.push([dat, x.peakcount]) - } - }) - } else { - utils.showError(data.err) - } - let dlt = DateTime.now() // retrieve the date - dlt = dlt.minus({day:30}) - - // Plot-Options - let options = utils.createGlobObtions() - options.xAxis.plotBands = utils.calcWeekends(data, true) - options.xAxis.tickInterval = 24 * 3600 * 1000 - options.xAxis.title = 'Date' - options.xAxis.labels = { - formatter: function () { - return this.axis.defaultLabelFormatter.call(this); - } - } - - options.chart.type = 'column' - options.yAxis = { - title: { - text: 'dbA', - useHTML: true, - }, - min: utils.noise_ymin, - tickAmount: 10, - gridLineColor: 'lightgray', - } - options.series = [ - { - name: 'Mean value LAeq', - data: series1, - color: utils.colors.eq, - type: 'column', - zIndex: 2, - }, - ] - options.plotOptions.column = { - pointWidth: 20, - groupPadding: 0.1 - } - options.title.text = 'Noise daily mean values' - options.subtitle.text = 'Daily mean values of LAeq for each full day
 ' - options.subtitle.useHTML = true - options.chart.zoomType = 'x' - options.chart.resetZoomButton= { - position: { - align: 'left', -// verticalAlign: 'bottom', - x: 20, - y: 300, - }, - relativeTo: 'chart' - } - options.tooltip.formatter = function () { - let y = Math.round(this.y * 10) / 10 - return '
' + - DateTime.fromMillis(this.x, {zone: 'utc'}).toFormat("dd.LL") + '
' + - '● ' + - this.series.name + ':  ' + y + '
' - } - - - // Do PLOT 1 - let ch = Highcharts.chart('dday', options, function (chart) { - utils.addSensorID2chart(chart, {sid: data.sid, indoor: data.indoor}, document.getElementById('dday').offsetWidth) - }) -/* - // Do PLOT 2 - options.series[0] = { - name: 'Peaks', - data: series2, - color: utils.colors.peaks, - type: 'column' - } - options.title.text = 'Peaks more than ' + data.peak + ' dbA' - options.subtitle.text = 'Number of exceedances per hour
 ' - options.yAxis = { - title: { - text: 'Counts', - useHTML: true, - }, - tickAmount: 10, - allowDecimals: false, - gridLineColor: 'lightgray', - } - options.tooltip.formatter = function () { - let y = Math.round(this.y) - return '
' + - DateTime.fromMillis(this.x, {zone: 'utc'}).toFormat("dd.LL - HH'h'") + '
' + - '● ' + - this.series.name + ':  ' + y + '
' - } - - let ch1 = Highcharts.chart('dpeak', options) -*/ -} - diff --git a/public/javascripts/chart_daynight.js b/public/javascripts/chart_daynight.js deleted file mode 100644 index 03c9861..0000000 --- a/public/javascripts/chart_daynight.js +++ /dev/null @@ -1,160 +0,0 @@ -// Sh0w the hour average chart -import {logit, logerror} from './logit.js' -import * as utils from './chart_utilities.js' -import {DateTime, Duration} from "./luxon.min.js" - -// ****************************************************************** -// PlotDayNightAVG_Noise -// ****************************************************************** - - -export const showDaynight = async (params) => { - await PlotDayNight_Noise(params.sid) -} - - -const PlotDayNight_Noise = async function (sid) { - - let series1 = [] - let series2 = [] - - // read the data from the server - const url = `${utils.url}/getsensordata?sensorid=${sid}&data=daynight` - let ret = await fetch(url) - .catch(e => { - logerror(e) - }) - let data = await ret.json() - - if(!data.err) { - // Put values into the serieses - let cnt = 0 - data.values.forEach((x) => { - if(x.n_AVG != -1) { - let dat = new Date(x.datetime).getTime() // retrieve the date - series1.push([dat, x.n_dayAVG]) - series2.push([dat, x.n_nightAVG]) - } - }) - } else { - utils.showError(data.err) - } - let dlt = DateTime.now() // retrieve the date - dlt = dlt.minus({day:30}) - - // Plot-Options - let options = utils.createGlobObtions() - options.xAxis.plotBands = utils.calcWeekends(data, true) - options.xAxis.tickInterval = 24 * 3600 * 1000 - options.xAxis.title = 'Date' - options.xAxis.labels = { - formatter: function () { - return this.axis.defaultLabelFormatter.call(this); - } - } - - options.chart.type = 'column' - options.yAxis = { - title: { - text: 'dbA', - useHTML: true, - }, - min: utils.noise_ymin, - tickAmount: 10, - gridLineColor: 'lightgray', - } - options.series = [ - { - name: 'Day', - data: series1, - color: utils.colors.eq, - type: 'column', - zIndex: 2, - }, - { - name: 'Night', - data: series2, - color: utils.colors.max, - type: 'column', - zIndex: 2, - }, - ] - options.plotOptions.series = { - animation: false - } - options.plotOptions.column = { - pointWidth: 20, - groupPadding: 0.3 - } - options.title.text = 'Noise Average values during the day and night hours' - options.subtitle.text = 'Daily mean values of LAeq from 6h00 to 22h00
Nightly mean values of LAeq from 22h00 to 6h00' - options.subtitle.useHTML = true - options.chart.zoomType = 'x' - options.chart.resetZoomButton= { - position: { - align: 'left', -// verticalAlign: 'bottom', - x: 20, - y: 300, - }, - relativeTo: 'chart' - } - options.tooltip.formatter = function () { - let n = this.series.name.startsWith('Night') - let d = DateTime.fromMillis(this.x, {zone: 'utc'}) - let d1 = d.plus({days: 1}) - let txt = n ? d.toFormat('dd') + '/' + d1.toFormat('dd.LL') : - d.toFormat('dd.LL') - return '
' + - '  ' + txt + '
' + - '● ' + - this.series.name + ':  ' + - Highcharts.numberFormat(this.y, 1) + - '
'; - } - -/* - formatter = function () { - let y = Math.round(this.y * 10) / 10 - return '
' + - DateTime.fromMillis(this.x, {zone: 'utc'}).toFormat("dd.LL") + '
' + - '● ' + - this.series.name + ':  ' + y + '
' - } -*/ - - // Do PLOT 1 - let ch = Highcharts.chart('ddaynight', options, function (chart) { - utils.addSensorID2chart(chart, {sid: data.sid, indoor: data.indoor}, document.getElementById('ddaynight').offsetWidth) - }) -/* - // Do PLOT 2 - options.series[0] = { - name: 'Peaks', - data: series2, - color: utils.colors.peaks, - type: 'column' - } - options.title.text = 'Peaks more than ' + data.peak + ' dbA' - options.subtitle.text = 'Number of exceedances per hour
 ' - options.yAxis = { - title: { - text: 'Counts', - useHTML: true, - }, - tickAmount: 10, - allowDecimals: false, - gridLineColor: 'lightgray', - } - options.tooltip.formatter = function () { - let y = Math.round(this.y) - return '
' + - DateTime.fromMillis(this.x, {zone: 'utc'}).toFormat("dd.LL - HH'h'") + '
' + - '● ' + - this.series.name + ':  ' + y + '
' - } - - let ch1 = Highcharts.chart('dpeak', options) -*/ -} - diff --git a/public/javascripts/chart_houravg.js b/public/javascripts/chart_houravg.js deleted file mode 100644 index b1a48cb..0000000 --- a/public/javascripts/chart_houravg.js +++ /dev/null @@ -1,129 +0,0 @@ -// Sh0w the hour average chart -import {logit, logerror} from './logit.js' -import * as utils from './chart_utilities.js' -import {DateTime, Duration} from "./luxon.min.js" - -// ****************************************************************** -// PlotHourAVG_Noise -// ****************************************************************** - - -export const showHouravg = async (params) => { - await PlotHourAVG_Noise(params.sid) -} - - -const PlotHourAVG_Noise = async function (sid) { - - let series1 = [] - let series2 = [] - - // read the data from the server - const url = `${utils.url}/getsensordata?sensorid=${sid}&data=havg` - let ret = await fetch(url) - .catch(e => { - logerror(e) - }) - let data = await ret.json() - - if(!data.err) { - - // Put values into the serieses - let cnt = 0 - data.values.forEach((x) => { - if (x.n_AVG != -1) { - let dat = new Date(x.datetime).getTime() // retrieve the date - series1.push([dat, x.n_AVG]) - series2.push([dat, x.peakcount]) - } - }) - } else { - utils.showError(data.err) - } - let dlt = DateTime.now() // retrieve the date - dlt = dlt.minus({day:1}) - - // Plot-Options - let options = utils.createGlobObtions() - options.xAxis.tickInterval = 6 * 3600 * 1000 - options.xAxis.plotBands = utils.calcWeekends(data, true) - options.xAxis.minTickInterval = 3600 * 1000 - - options.yAxis = { - title: { - text: 'dbA', - useHTML: true, - }, - min: utils.noise_ymin, - tickAmount: 10, - gridLineColor: 'lightgray', - } - options.series = [ - { - name: 'Mean value LAeq', - data: series1, - color: utils.colors.eq, - type: 'column', - zIndex: 2, - }, - ] - options.plotOptions.column = { - pointWidth: 8, - groupPadding: 0.5 - } - options.title.text = 'Noise hourly mean values' - options.subtitle.text = 'Hourly mean values of LAeq for each full hour
 ' - options.subtitle.useHTML = true - options.chart.zoomType = 'x' - options.chart.height = 350 - options.chart.resetZoomButton= { - position: { - align: 'left', -// verticalAlign: 'bottom', - x: 20, - y: 300, - }, - relativeTo: 'chart' - } - options.tooltip.formatter = function () { - let y = Math.round(this.y * 10) / 10 - return '
' + - DateTime.fromMillis(this.x, {zone: 'utc'}).toFormat("dd.LL - HH'h'") + '
' + - '● ' + - this.series.name + ':  ' + y + '
' - } - - - // Do PLOT 1 - let ch = Highcharts.chart('dhour', options, function (chart) { - utils.addSensorID2chart(chart, {sid: data.sid, indoor: data.indoor}, document.getElementById('dhour').offsetWidth) - }) - // Do PLOT 2 - options.series[0] = { - name: 'Peaks', - data: series2, - color: utils.colors.peaks, - type: 'column' - } - options.title.text = 'Peaks more than ' + data.peak + ' dbA' - options.subtitle.text = 'Number of exceedances per hour
 ' - options.yAxis = { - title: { - text: 'Counts', - useHTML: true, - }, - tickAmount: 10, - allowDecimals: false, - gridLineColor: 'lightgray', - } - options.tooltip.formatter = function () { - let y = Math.round(this.y) - return '
' + - DateTime.fromMillis(this.x, {zone: 'utc'}).toFormat("dd.LL - HH'h'") + '
' + - '● ' + - this.series.name + ':  ' + y + '
' - } - - let ch1 = Highcharts.chart('dpeak', options) -} - diff --git a/public/javascripts/chart_lden.js b/public/javascripts/chart_lden.js deleted file mode 100644 index 38c60d3..0000000 --- a/public/javascripts/chart_lden.js +++ /dev/null @@ -1,112 +0,0 @@ -// Sh0w the hour average chart -import {logit, logerror} from './logit.js' -import * as utils from './chart_utilities.js' -import {DateTime, Duration} from "./luxon.min.js" - -// ****************************************************************** -// PlotLDEN_Noise -// ****************************************************************** - - -export const showLden = async (params) => { - await PlotLDEN_Noise(params.sid) -} - - -const PlotLDEN_Noise = async function (sid) { - - let series1 = [] - - // read the data from the server - const url = `${utils.url}/getsensordata?sensorid=${sid}&data=lden` - let ret = await fetch(url) - .catch(e => { - logerror(e) - }) - let data = await ret.json() - - if (!data.err) { - // Put values into the serieses - let cnt = 0 - data.values.forEach((x) => { - if(x.n_AVG != -1) { - let dat = new Date(x.datetime).getTime() // retrieve the date - series1.push([dat, x.lden]) - } - }) - } else { - utils.showError(data.err) - } - let dlt = DateTime.now() // retrieve the date - dlt = dlt.minus({day:30}) - - // Plot-Options - let options = utils.createGlobObtions() - - options.xAxis.plotBands = utils.calcWeekends(data, true) - options.xAxis.tickInterval = 24 * 3600 * 1000 - options.xAxis.title = 'Date' - options.xAxis.labels = { - formatter: function () { - let lbl = this.axis.defaultLabelFormatter.call(this); - this.value += 86400000; - let lbl1 = this.axis.defaultLabelFormatter.call(this); - return parseInt(lbl) + '/' + lbl1; - } - } - options.chart.type = 'column' - options.yAxis = { - title: { - text: 'dbA', - useHTML: true, - }, - min: utils.noise_ymin, - tickAmount: 10, - gridLineColor: 'lightgray', - } - options.series = [ - { - name: 'lden', - data: series1, - color: utils.colors.eq, - type: 'column', - zIndex: 2, - } - ] - options.plotOptions.series = { - animation: false - } - options.plotOptions.column = { - pointWidth: 20, - groupPadding: 0.1 - } - options.title.text = 'Noise LDEN-Index' - options.subtitle.text = 'Daily mean values of LDEN\-Index' - options.subtitle.useHTML = true - options.chart.zoomType = 'x' - options.chart.resetZoomButton= { - position: { - align: 'left', -// verticalAlign: 'bottom', - x: 20, - y: 300, - }, - relativeTo: 'chart' - } - options.tooltip.formatter = function () { - let d = DateTime.fromMillis(this.x, {zone: 'utc'}) - let d1 = d.plus({days: 1}) - let txt = d.toFormat('dd') + '/' + d1.toFormat('dd.LL') - return '
' + - '  ' + txt + '
' + - '● ' + - this.series.name + ':  ' + - Highcharts.numberFormat(this.y, 1) + - '
'; - } - - let ch = Highcharts.chart('dlden', options, function (chart) { - utils.addSensorID2chart(chart, {sid: data.sid, indoor: data.indoor}, document.getElementById('dlden').offsetWidth) - }) -} - diff --git a/public/javascripts/chart_live.js b/public/javascripts/chart_live.js deleted file mode 100644 index 2ae1595..0000000 --- a/public/javascripts/chart_live.js +++ /dev/null @@ -1,68 +0,0 @@ -// Show the live data chart -import {logit, logerror} from './logit.js' -import * as utils from './chart_utilities.js' -import {DateTime} from "./luxon.min.js"; - -// ****************************************************************** -// PlotDayLive_Noise -// ****************************************************************** - - -export const showLive = async (params) => { - const url = `/chart/getsensordata?&sensorid=${params.sid}` - let ret = await fetch(url) - .catch(e => { - logerror(e) - }); - let erg = await ret.json() - - let chr = Highcharts.chart('dlive', erg.options, function (chart) { - utils.addSensorID2chart(chart, {sid: erg.params.sensorid, indoor: erg.params.indoor}, document.getElementById('dlive').offsetWidth) - }) -} -/* -let butOpts = [ - {fill: 'lightblue', r: 2}, - {fill: 'blue', r: 2, style: {color: 'white'}}, - {fill: 'lightblue', r: 2}, - {fill: 'lightblue', r: 2} -] - - -function renderPfeil(n, chart, x, y, txt, time) { - chart.renderer.button(txt, x, y, null, butOpts[0], butOpts[1], butOpts[2], butOpts[3]) - .attr({ - id: 'button' + n, - zIndex: 3, - width: 30, - }) - .on('click', function () { - prevHour(time) - }) - .add() -} - -function prevHour(hours) { - console.log("Zurück um ", hours, "Stunden") - let start - if (startDay == "") { - start = moment() - start.subtract(24, 'h') - } else { - start = moment(startDay) - } - let mrk = moment() - mrk.subtract(24, 'h') - let startDay = "" - if (hours < 0) { - start.subtract(Math.abs(hours), 'h') - startDay = start.format("YYYY-MM-DDTHH:mm:ssZ") - } else if (hours > 0) { - start.add(hours, 'h') - if (!start.isAfter(mrk)) { - startDay = start.format("YYYY-MM-DDTHH:mm:ssZ") - } - } - doPlot('live', startDay) -} -*/ diff --git a/public/javascripts/global.js b/public/javascripts/global.js index 3e3ad07..2cc2de0 100644 --- a/public/javascripts/global.js +++ b/public/javascripts/global.js @@ -4,12 +4,6 @@ import * as map from './map.js' import * as dt from './datetime.js' import {logerror, logit} from './logit.js' -import * as chart_live from './chart_live.js' -import * as chart_houravg from './chart_houravg.js' -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, loadAll, showChart} from './showcharts.js' import { DateTime } from './luxon.min.js' diff --git a/public/javascripts/map.js b/public/javascripts/map.js index dab4cec..dc27f72 100644 --- a/public/javascripts/map.js +++ b/public/javascripts/map.js @@ -1,7 +1,6 @@ // all function related to the map import * as dt from './datetime.js' -import * as chart_live from "./chart_live.js" import * as utils from "./chart_utilities.js" import { showChart, loadAll } from './showcharts.js'