From a774a00c247de474a1d798cba531a7a1bc759b2c Mon Sep 17 00:00:00 2001 From: frankknoll Date: Sun, 11 Jun 2023 09:57:37 +0200 Subject: [PATCH] refactoring --- docs/BatchCodeTableInitializer.js | 12 +++++++++--- docs/BatchcodeByCountryBarChart.js | 6 +++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/BatchCodeTableInitializer.js b/docs/BatchCodeTableInitializer.js index 76715a505e3..2aef4566847 100644 --- a/docs/BatchCodeTableInitializer.js +++ b/docs/BatchCodeTableInitializer.js @@ -118,12 +118,18 @@ class BatchCodeTableInitializer { #displayBatchcodeByCountryBarChart(batchcode, barChartDescriptions, uiContainer) { if (batchcode in barChartDescriptions.barChartDescriptions) { - const barChartDescription = barChartDescriptions.barChartDescriptions[batchcode]; - barChartDescription['batchcode'] = batchcode; - new BatchcodeByCountryBarChartView(uiContainer).displayBatchcodeByCountryBarChart(barChartDescription); + new BatchcodeByCountryBarChartView(uiContainer) + .displayBatchcodeByCountryBarChart(this.#getBarChartDescription(barChartDescriptions, batchcode)); } } + #getBarChartDescription(barChartDescriptions, batchcode) { + const barChartDescription = barChartDescriptions.barChartDescriptions[batchcode]; + barChartDescription.batchcode = batchcode; + barChartDescription.dateRange = barChartDescriptions.dateRange; + return barChartDescription; + } + #setVisibilityOfCountriesColumn(batchCodeTable, showCountriesColumn) { batchCodeTable .column(this.#getColumnIndex('Countries')) diff --git a/docs/BatchcodeByCountryBarChart.js b/docs/BatchcodeByCountryBarChart.js index 9117a800901..df4c6f6d432 100644 --- a/docs/BatchcodeByCountryBarChart.js +++ b/docs/BatchcodeByCountryBarChart.js @@ -35,13 +35,17 @@ class BatchcodeByCountryBarChart { data: barChartDescription["frequencies before deletion"] }, { - label: "frequencies guessed", // FK-TODO: daterange einfügen + label: `frequencies guessed ${this.#dateRange2str(barChartDescription.dateRange)}`, data: barChartDescription["frequencies guessed"] } ] }; } + #dateRange2str(dateRange) { + return `${dateRange.start} - ${dateRange.end}`; + } + #getOptions() { return { plugins: {