From 9ef468cf746f3d9b4b05c60a720ffdda37cf9fe4 Mon Sep 17 00:00:00 2001 From: rxf Date: Tue, 4 Apr 2023 14:42:49 +0200 Subject: [PATCH] Peaks merged to havg/davg utilities/chartoptions.js - removed chart height from global options sensorspecials/noiseChart.js - changed sam texts /tile, subtitle) --- sensorspecials/noiseChart.js | 146 +++++++++++++++++------------------ utilities/chartoptions.js | 19 +++-- 2 files changed, 82 insertions(+), 83 deletions(-) diff --git a/sensorspecials/noiseChart.js b/sensorspecials/noiseChart.js index 3ee3494..a3ca4fe 100644 --- a/sensorspecials/noiseChart.js +++ b/sensorspecials/noiseChart.js @@ -136,7 +136,7 @@ export const liveData = (params, values) => { options.yAxis = [] options.series[0] = series_LAeq options.series[1] = series_LAMin - options.title.text = 'Noise level for one day' + options.title.text = 'Noise levels last 24 hours' options.subtitle.useHTML = true options.subtitle.text = '2.5min log. average values
 ' options.series[2] = series_LAMax @@ -205,15 +205,26 @@ export const havgData = (params, values) => { // 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.yAxis = [ + { + title: { + text: 'dbA', + useHTML: true, + }, + min: utils.noise_ymin, + tickAmount: 10, + gridLineColor: 'lightgray' + }, { + title: { + text: 'Counts', + useHTML: true, + }, + tickAmount: 10, + allowDecimals: false, + gridLineColor: 'lightgray', + opposite: true + } + ] options.series = [ { name: 'Mean value LAeq', @@ -221,17 +232,28 @@ export const havgData = (params, values) => { color: utils.colors.eq, type: 'column', zIndex: 2, - }, - ] + yAxis: 0 + }, { + name: 'Peaks', + data: series2, + color: utils.colors.peaks, + type: 'column', + yAxis: 1 + } + ] + // options.plotOptions.column = { + // pointWidth: 8, + // groupPadding: 0.5 + // } options.plotOptions.column = { pointWidth: 8, - groupPadding: 0.5 + groupPadding: 0.1 } - options.title.text = 'Noise hourly mean values' - options.subtitle.text = 'Hourly mean values of LAeq for each full hour
 ' + + options.title.text = 'Hourly mean values / Peaks over ' + params.peak + ' dbA' + options.subtitle.text = 'Hourly mean values of LAeq for each full hour / Number of peaks per hour' options.subtitle.useHTML = true options.chart.zoomType = 'x' - options.chart.height = 350 options.chart.resetZoomButton= { position: { align: 'left', @@ -241,27 +263,7 @@ export const havgData = (params, values) => { relativeTo: 'chart' } - // Calculate to plot peaks - let options2 = JSON.parse(JSON.stringify(options)); - options2.series[0] = { - name: 'Peaks', - data: series2, - color: utils.colors.peaks, - type: 'column' - } - options2.title.text = 'Peaks more than ' + params.peak + ' dbA' - options2.subtitle.text = 'Number of exceedances per hour
 ' - options2.yAxis = { - title: { - text: 'Counts', - useHTML: true, - }, - tickAmount: 10, - allowDecimals: false, - gridLineColor: 'lightgray', - } - - return { options: options, options2: options2, params: params} + return { options: options, params: params} } @@ -299,17 +301,28 @@ export const havgData = (params, values) => { // } options.chart.type = 'column' - options.chart.height = 350 - options.yAxis = { - title: { - text: 'dbA', - useHTML: true, - }, - min: utils.noise_ymin, - tickAmount: 10, - gridLineColor: 'lightgray', - } + options.yAxis = [ + { + title: { + text: 'dbA', + useHTML: true, + }, + min: utils.noise_ymin, + tickAmount: 10, + gridLineColor: 'lightgray', + }, { + title: { + text: 'Counts', + useHTML: true, + }, + tickAmount: 10, + allowDecimals: false, + gridLineColor: 'lightgray', + opposite: true + } + ] + options.series = [ { name: 'Mean value LAeq', @@ -317,14 +330,21 @@ export const havgData = (params, values) => { color: utils.colors.eq, type: 'column', zIndex: 2, - }, + yAxis: 0 + },{ + name: 'Peaks', + data: series2, + color: utils.colors.peaks, + type: 'column', + yAxis: 1, + } ] 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.title.text = 'Daily mean values / Peaks over ' + params.peak + ' dbA' + options.subtitle.text = 'Daily mean values of LAeq for each full day / Number of peaks per day' options.subtitle.useHTML = true options.chart.zoomType = 'x' options.chart.resetZoomButton = { @@ -337,27 +357,7 @@ export const havgData = (params, values) => { relativeTo: 'chart' } - // Calculate to plot peaks - let options2 = JSON.parse(JSON.stringify(options)); - options2.series[0] = { - name: 'Peaks', - data: series2, - color: utils.colors.peaks, - type: 'column' - } - options2.title.text = 'Peaks more than ' + params.peak + ' dbA' - options2.subtitle.text = 'Number of exceedances per day
 ' - options2.yAxis = { - title: { - text: 'Counts', - useHTML: true, - }, - tickAmount: 10, - allowDecimals: false, - gridLineColor: 'lightgray', - } - - return {options: options, options2: options2, params: params} + return {options: options, params: params} } @@ -426,7 +426,7 @@ export const dayNightData = (params, values) => { pointWidth: 20, groupPadding: 0.3 } - options.title.text = 'Noise Average values during the day and night hours' + options.title.text = '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' @@ -501,7 +501,7 @@ export const ldenData = (params, values) => { pointWidth: 20, groupPadding: 0.1 } - options.title.text = 'Noise LDEN-Index' + options.title.text = 'LDEN-Index' options.subtitle.text = 'Daily mean values of LDEN\-Index' options.subtitle.useHTML = true options.chart.zoomType = 'x' diff --git a/utilities/chartoptions.js b/utilities/chartoptions.js index 085914f..df39af1 100644 --- a/utilities/chartoptions.js +++ b/utilities/chartoptions.js @@ -7,7 +7,6 @@ export function createGlobObtions() { // Options, die für alle Plots identisch sind let globObject = { chart: { - height: 600, spacingRight: 20, spacingLeft: 20, spacingTop: 25, @@ -20,15 +19,15 @@ export function createGlobObtions() { }, type: 'line', borderWidth: '2', - events: { - selection: function (event) { - if (event.xAxis) { - doUpdate = false; - } else { - doUpdate = true; - } - } - } + // events: { + // selection: function (event) { + // if (event.xAxis) { + // doUpdate = false; + // } else { + // doUpdate = true; + // } + // } + // } }, title: { align: 'left',