refactoring

This commit is contained in:
frankknoll
2023-11-09 12:15:48 +01:00
parent 6f20261d23
commit cee3c38e00
4 changed files with 50 additions and 33 deletions

View File

@@ -0,0 +1,44 @@
class SymptomVsSymptomChartViewInitializer {
#symptomVsSymptomChartView;
#symptomX;
#symptomY;
configureSymptomVsSymptomChart(
{ symptomSelectXElement, symptomSelectYElement, symptomVsSymptomChartViewElement },
initializeSelectElement) {
this.#symptomVsSymptomChartView = new SymptomVsSymptomChartView(symptomVsSymptomChartViewElement);
{
initializeSelectElement(
{
selectElement: symptomSelectXElement,
onValueSelected: symptomX => {
this.#symptomX = symptomX;
this.#loadAndDisplayChart();
},
minimumInputLength: 4
});
this.#symptomX = null;
}
{
initializeSelectElement(
{
selectElement: symptomSelectYElement,
onValueSelected: symptomY => {
this.#symptomY = symptomY;
this.#loadAndDisplayChart();
},
minimumInputLength: 4
});
this.#symptomY = null;
}
this.#loadAndDisplayChart();
}
#loadAndDisplayChart() {
if (this.#symptomX != null && this.#symptomY != null) {
this.#symptomVsSymptomChartView.loadAndDisplayChart(this.#symptomX, this.#symptomY);
}
}
}