displaying some scatter chart
This commit is contained in:
@@ -7,30 +7,22 @@ class SymptomVsSymptomChartView {
|
|||||||
this.#canvas = canvas;
|
this.#canvas = canvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
displayChart(symptom1, symptom2) {
|
displayChart(symptomX, symptomY) {
|
||||||
if (this.#chart != null) {
|
if (this.#chart != null) {
|
||||||
this.#chart.destroy();
|
this.#chart.destroy();
|
||||||
}
|
}
|
||||||
// FK-TODO: fetch multiple files: https://stackoverflow.com/a/31711496 or https://stackoverflow.com/a/53892713
|
// FK-TODO: fetch multiple files: https://stackoverflow.com/a/31711496 or https://stackoverflow.com/a/53892713
|
||||||
PrrByVaccineProvider.getPrrByVaccine(symptom1)
|
PrrByVaccineProvider.getPrrByVaccine(symptomX)
|
||||||
.then(
|
.then(
|
||||||
prrByLot1 => {
|
prrByLotX => {
|
||||||
PrrByVaccineProvider.getPrrByVaccine(symptom2)
|
PrrByVaccineProvider.getPrrByVaccine(symptomY)
|
||||||
.then(
|
.then(
|
||||||
prrByLot2 => {
|
prrByLotY => {
|
||||||
const myData =
|
const chartData = SymptomVsSymptomChartDataProvider.getChartData({ prrByLotX, prrByLotY });
|
||||||
Object
|
|
||||||
.values(prrByLot2)
|
|
||||||
.map(
|
|
||||||
val =>
|
|
||||||
({
|
|
||||||
x: val,
|
|
||||||
y: val
|
|
||||||
}));
|
|
||||||
const data = {
|
const data = {
|
||||||
datasets: [{
|
datasets: [{
|
||||||
label: 'Scatter Dataset',
|
label: 'Scatter Dataset',
|
||||||
data: myData,
|
data: chartData,
|
||||||
backgroundColor: 'rgb(255, 99, 132)'
|
backgroundColor: 'rgb(255, 99, 132)'
|
||||||
}],
|
}],
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user