From 010af053ab43acdcfe5920a21d0f32fa4042dc20 Mon Sep 17 00:00:00 2001 From: frankknoll Date: Wed, 8 Nov 2023 22:37:09 +0100 Subject: [PATCH] displaying some scatter chart --- .../js/SymptomVsSymptomChartView.js | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/docs/SymptomsCausedByCOVIDLots/js/SymptomVsSymptomChartView.js b/docs/SymptomsCausedByCOVIDLots/js/SymptomVsSymptomChartView.js index 52cc8c916c8..a71e8ee8dcd 100644 --- a/docs/SymptomsCausedByCOVIDLots/js/SymptomVsSymptomChartView.js +++ b/docs/SymptomsCausedByCOVIDLots/js/SymptomVsSymptomChartView.js @@ -7,30 +7,22 @@ class SymptomVsSymptomChartView { this.#canvas = canvas; } - displayChart(symptom1, symptom2) { + displayChart(symptomX, symptomY) { if (this.#chart != null) { this.#chart.destroy(); } // FK-TODO: fetch multiple files: https://stackoverflow.com/a/31711496 or https://stackoverflow.com/a/53892713 - PrrByVaccineProvider.getPrrByVaccine(symptom1) + PrrByVaccineProvider.getPrrByVaccine(symptomX) .then( - prrByLot1 => { - PrrByVaccineProvider.getPrrByVaccine(symptom2) + prrByLotX => { + PrrByVaccineProvider.getPrrByVaccine(symptomY) .then( - prrByLot2 => { - const myData = - Object - .values(prrByLot2) - .map( - val => - ({ - x: val, - y: val - })); + prrByLotY => { + const chartData = SymptomVsSymptomChartDataProvider.getChartData({ prrByLotX, prrByLotY }); const data = { datasets: [{ label: 'Scatter Dataset', - data: myData, + data: chartData, backgroundColor: 'rgb(255, 99, 132)' }], };