diff --git a/docs/BatchCodeDetailsView.js b/docs/BatchCodeDetailsView.js index b4fe59ff093..9fa64a8ab06 100644 --- a/docs/BatchCodeDetailsView.js +++ b/docs/BatchCodeDetailsView.js @@ -2,7 +2,6 @@ class BatchCodeDetailsView { #uiContainer; #headingElement; - #batchCodesSelectElement; #adverseReactionReportsChartView; #histogramChartView; #chartWithSlider; @@ -10,7 +9,6 @@ class BatchCodeDetailsView { constructor(uiContainer) { this.#uiContainer = uiContainer this.#headingElement = this.#uiContainer.querySelector(".heading"); - this.#batchCodesSelectElement = new ElementWithSingleChangeEventListener(this.#uiContainer.querySelector("#batchCodesSelect")); this.#adverseReactionReportsChartView = new AdverseReactionReportsChartView(this.#uiContainer.querySelector('#adverseReactionReportsChartView')); this.#chartWithSlider = this.#uiContainer.querySelector('.chartWithSlider'); this.#histogramChartView = new HistogramChartView(this.#chartWithSlider.querySelector("canvas")); @@ -36,8 +34,7 @@ class BatchCodeDetailsView { #displayHistogramViewForHistoDescrs(histoDescrs) { this.#displayHeading(histoDescrs.batchcode, histoDescrs['Company']); this.#displayAdverseReactionReportsChart(histoDescrs); - this.#displaySelectBatchcodeCombination(histoDescrs.histograms); - this.#displayHistogram(histoDescrs.histograms[0]); + this.#displayHistogram(histoDescrs); } #displayHeading(batchcode, company) { @@ -54,15 +51,6 @@ class BatchCodeDetailsView { }); } - #displaySelectBatchcodeCombination(histograms) { - BatchcodeCombinationSelection.configureSelectBatchcodeCombinationElement( - { - batchCodesSelectElement: this.#batchCodesSelectElement, - histograms: histograms, - onSelect: histoDescr => this.#displayHistogram(histoDescr) - }); - } - #displayHistogram(histoDescr) { this.#histogramChartView.displayChart(histoDescr); this.#createSlider( @@ -80,7 +68,7 @@ class BatchCodeDetailsView { #slice(histoDescr, { start, endInclusive }) { return { - batchcodes: histoDescr.batchcodes, + batchcode: histoDescr.batchcode, histogram: Utils.sliceDict(histoDescr.histogram, start, endInclusive + 1) }; } diff --git a/docs/BatchcodeCombinationSelection.js b/docs/BatchcodeCombinationSelection.js deleted file mode 100644 index 3cf854125f4..00000000000 --- a/docs/BatchcodeCombinationSelection.js +++ /dev/null @@ -1,28 +0,0 @@ -class BatchcodeCombinationSelection { - - static configureSelectBatchcodeCombinationElement({ batchCodesSelectElement, histograms, onSelect }) { - this.#setBatchcodeCombinationOptions(batchCodesSelectElement.element, histograms); - batchCodesSelectElement.setSingleChangeEventListener( - event => { - const histoDescr = histograms[event.target.value]; - onSelect(histoDescr); - }); - onSelect(histograms[0]); - } - - static #setBatchcodeCombinationOptions(batchCodesSelectElement, histograms) { - UIUtils.clear(batchCodesSelectElement); - this.#getBatchcodeCombinationOptions(histograms).forEach(option => batchCodesSelectElement.add(option)); - } - - static #getBatchcodeCombinationOptions(histograms) { - return histograms.map(this.#getBatchcodeCombinationOption); - } - - static #getBatchcodeCombinationOption(histoDescr, index) { - const option = document.createElement("option"); - option.text = histoDescr.batchcodes.join(', '); - option.value = index; - return option; - } -} \ No newline at end of file diff --git a/docs/ElementWithSingleChangeEventListener.js b/docs/ElementWithSingleChangeEventListener.js deleted file mode 100644 index 784e5b51a8c..00000000000 --- a/docs/ElementWithSingleChangeEventListener.js +++ /dev/null @@ -1,18 +0,0 @@ -class ElementWithSingleChangeEventListener { - - element; - #changeEventListenerOfElement; - - constructor(element) { - this.element = element; - } - - setSingleChangeEventListener(singleChangeEventListener) { - const eventType = 'change'; - if (this.#changeEventListenerOfElement !== undefined) { - this.element.removeEventListener(eventType, this.#changeEventListenerOfElement); - } - this.element.addEventListener(eventType, singleChangeEventListener); - this.#changeEventListenerOfElement = singleChangeEventListener; - } -} diff --git a/docs/HistoDescrsProvider.js b/docs/HistoDescrsProvider.js index c20aeb72206..db099f508e5 100644 --- a/docs/HistoDescrsProvider.js +++ b/docs/HistoDescrsProvider.js @@ -5,6 +5,8 @@ class HistoDescrsProvider { .then(response => response.json()) .then(histoDescrs => { histoDescrs.histograms.sort((histoDescr1, histoDescr2) => histoDescr1.batchcodes.length - histoDescr2.batchcodes.length); + histoDescrs.histogram = histoDescrs.histograms[0].histogram; + delete histoDescrs.histograms; return histoDescrs; }); } diff --git a/docs/HistogramChartView.js b/docs/HistogramChartView.js index 53717940acd..a69bacf40fb 100644 --- a/docs/HistogramChartView.js +++ b/docs/HistogramChartView.js @@ -31,7 +31,7 @@ class HistogramChartView { return { labels: symptoms, datasets: [{ - label: histoDescr.batchcodes.join(', '), + label: histoDescr.batchcode, data: frequencies }] }; diff --git a/docs/batchCodeTable.html b/docs/batchCodeTable.html index e00b73689aa..58044f8e669 100644 --- a/docs/batchCodeTable.html +++ b/docs/batchCodeTable.html @@ -30,13 +30,11 @@ - -