diff --git a/docs/SymptomsCausedByCOVIDLots/index.html b/docs/SymptomsCausedByCOVIDLots/index.html
index d636a307d92..ac6479ddd52 100644
--- a/docs/SymptomsCausedByCOVIDLots/index.html
+++ b/docs/SymptomsCausedByCOVIDLots/index.html
@@ -9,14 +9,14 @@
Safety Signals for COVID Batches
-
+
@@ -60,7 +60,8 @@
symptomVsSymptomChart: {
symptomSelectXElement: $('#symptomSelectX'),
symptomSelectYElement: $('#symptomSelectY'),
- symptomVsSymptomChartViewElement: document.querySelector('#symptomVsSymptomChartView')
+ symptomVsSymptomChartViewElement: document.querySelector('#symptomVsSymptomChartView'),
+ downloadSymptomVsSymptomChartButton: document.querySelector("#downloadSymptomVsSymptomChart")
}
}
);
@@ -40192,7 +40193,10 @@
-
+
+
+
+
diff --git a/docs/SymptomsCausedByCOVIDLots/js/SymptomVsSymptomChartView.js b/docs/SymptomsCausedByCOVIDLots/js/SymptomVsSymptomChartView.js
index e9a837563a3..a4318008964 100644
--- a/docs/SymptomsCausedByCOVIDLots/js/SymptomVsSymptomChartView.js
+++ b/docs/SymptomsCausedByCOVIDLots/js/SymptomVsSymptomChartView.js
@@ -8,12 +8,13 @@ class SymptomVsSymptomChartView {
}
loadAndDisplayChart(symptomX, symptomY) {
- Promise
+ return Promise
.all([symptomX, symptomY].map(symptom => PrrByVaccineProvider.getPrrByVaccine(symptom)))
.then(
([prrByLotX, prrByLotY]) => {
const { labels, data } = SymptomVsSymptomChartDataProvider.getChartData({ prrByLotX, prrByLotY });
this.#displayChart(symptomX, symptomY, labels, data);
+ return { labels, data };
});
}
diff --git a/docs/SymptomsCausedByCOVIDLots/js/SymptomVsSymptomChartViewInitializer.js b/docs/SymptomsCausedByCOVIDLots/js/SymptomVsSymptomChartViewInitializer.js
index ce3d5dd634a..b7a0d3db911 100644
--- a/docs/SymptomsCausedByCOVIDLots/js/SymptomVsSymptomChartViewInitializer.js
+++ b/docs/SymptomsCausedByCOVIDLots/js/SymptomVsSymptomChartViewInitializer.js
@@ -3,11 +3,15 @@ class SymptomVsSymptomChartViewInitializer {
#symptomVsSymptomChartView;
#symptomX;
#symptomY;
+ #batches;
+ #data;
+ #downloadSymptomVsSymptomChartButton;
configureSymptomVsSymptomChart(
- { symptomSelectXElement, symptomSelectYElement, symptomVsSymptomChartViewElement },
+ { symptomSelectXElement, symptomSelectYElement, symptomVsSymptomChartViewElement, downloadSymptomVsSymptomChartButton },
initializeSelectElement) {
+ this.#initializeButton(downloadSymptomVsSymptomChartButton);
this.#symptomVsSymptomChartView = new SymptomVsSymptomChartView(symptomVsSymptomChartViewElement);
{
initializeSelectElement(
@@ -37,8 +41,44 @@ class SymptomVsSymptomChartViewInitializer {
}
#loadAndDisplayChart() {
- if (this.#symptomX != null && this.#symptomY != null) {
- this.#symptomVsSymptomChartView.loadAndDisplayChart(this.#symptomX, this.#symptomY);
+ UIUtils.disableButton(this.#downloadSymptomVsSymptomChartButton);
+ if (this.#symptomX == null || this.#symptomY == null) {
+ return;
}
+
+ this.#symptomVsSymptomChartView
+ .loadAndDisplayChart(this.#symptomX, this.#symptomY)
+ .then(({ labels, data }) => {
+ this.#batches = labels;
+ this.#data = data;
+ UIUtils.enableButton(this.#downloadSymptomVsSymptomChartButton);
+ });
+ }
+
+ #initializeButton(downloadSymptomVsSymptomChartButton) {
+ this.#downloadSymptomVsSymptomChartButton = downloadSymptomVsSymptomChartButton;
+ UIUtils.disableButton(downloadSymptomVsSymptomChartButton);
+ downloadSymptomVsSymptomChartButton.addEventListener(
+ 'click',
+ () => this.#downloadSymptomVsSymptomChart())
+ }
+
+ #downloadSymptomVsSymptomChart() {
+ UIUtils.downloadUrlAsFilename(
+ window.URL.createObjectURL(
+ new Blob(
+ [
+ ScatterChart2CsvConverter.convertScatterChart2Csv(
+ {
+ symptomX: this.#symptomX,
+ symptomY: this.#symptomY,
+ batches: this.#batches,
+ data: this.#data
+ }
+ )
+ ],
+ { type: 'text/csv' })),
+ `${this.#symptomX} Vs ${this.#symptomY}`
+ );
}
}
\ No newline at end of file