refactoring

This commit is contained in:
frankknoll
2023-04-15 22:26:42 +02:00
parent c0edd89606
commit 630a2879fa
3 changed files with 7 additions and 5 deletions

View File

@@ -1,12 +1,14 @@
class BatchCodeDetailsView {
#uiContainer;
#headingElement;
#adverseReactionReportsChartView;
#histogramChartView;
#chartWithSlider;
constructor(uiContainer) {
this.#uiContainer = uiContainer
this.#headingElement = this.#uiContainer.querySelector(".heading");
this.#adverseReactionReportsChartView = new AdverseReactionReportsChartView(this.#uiContainer.querySelector('#adverseReactionReportsChartView'));
this.#chartWithSlider = this.#uiContainer.querySelector('.chartWithSlider');
this.#histogramChartView = new HistogramChartView(this.#chartWithSlider.querySelector("canvas"));
@@ -39,9 +41,7 @@ class BatchCodeDetailsView {
}
#displayHeading(batchcode) {
const h1 = document.createElement("h3");
h1.appendChild(document.createTextNode(`Frequencies of reported Symptoms for Batch Code Combinations containing ${batchcode}`));
this.#uiContainer.appendChild(h1);
this.#headingElement.textContent = `Frequencies of reported Symptoms for Batch Code Combinations containing ${batchcode}`
}
#displayAdverseReactionReportsChart(histoDescrs) {

View File

@@ -2,7 +2,7 @@ class BatchcodeCombinationSelection {
static configureSelectBatchcodeCombinationElement({ selectBatchcodeCombinationElement, histograms, onSelect }) {
const batchcodesSelect = selectBatchcodeCombinationElement.querySelector('#batchcodesSelect');
this.#addBatchcodeCombinationOptions(batchcodesSelect, histograms);
this.#setBatchcodeCombinationOptions(batchcodesSelect, histograms);
batchcodesSelect.addEventListener(
'change',
event => {
@@ -12,7 +12,8 @@ class BatchcodeCombinationSelection {
onSelect(histograms[0]);
}
static #addBatchcodeCombinationOptions(batchcodesSelect, histograms) {
static #setBatchcodeCombinationOptions(batchcodesSelect, histograms) {
UIUtils.clear(batchcodesSelect);
this.#getBatchcodeCombinationOptions(histograms).forEach(option => batchcodesSelect.add(option));
}

View File

@@ -49763,6 +49763,7 @@
</select>
</p>
<div id="batchCodeDetails" style="width: 50%">
<h3 class="heading"></h3>
<div id="selectBatchcodeCombination">
<canvas id="adverseReactionReportsChartView"></canvas>
<label>Select batchcode combination: