making scatter chart for symptoms downloadable
This commit is contained in:
@@ -9,14 +9,14 @@
|
|||||||
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
||||||
<title>Safety Signals for COVID Batches</title>
|
<title>Safety Signals for COVID Batches</title>
|
||||||
<!-- Google tag (gtag.js) -->
|
<!-- Google tag (gtag.js) -->
|
||||||
<!-- <script async="" src="https://www.googletagmanager.com/gtag/js?id=G-ERHYDH4P64"></script>
|
<script async="" src="https://www.googletagmanager.com/gtag/js?id=G-ERHYDH4P64"></script>
|
||||||
<script>
|
<script>
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
function gtag() { dataLayer.push(arguments); }
|
function gtag() { dataLayer.push(arguments); }
|
||||||
gtag('js', new Date());
|
gtag('js', new Date());
|
||||||
|
|
||||||
gtag('config', 'G-ERHYDH4P64');
|
gtag('config', 'G-ERHYDH4P64');
|
||||||
</script> -->
|
</script>
|
||||||
<!-- Bootstrap -->
|
<!-- Bootstrap -->
|
||||||
<link href="../gentelella/vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" />
|
<link href="../gentelella/vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" />
|
||||||
<link href="https://cdn.datatables.net/1.13.1/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
|
<link href="https://cdn.datatables.net/1.13.1/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
|
||||||
@@ -60,7 +60,8 @@
|
|||||||
symptomVsSymptomChart: {
|
symptomVsSymptomChart: {
|
||||||
symptomSelectXElement: $('#symptomSelectX'),
|
symptomSelectXElement: $('#symptomSelectX'),
|
||||||
symptomSelectYElement: $('#symptomSelectY'),
|
symptomSelectYElement: $('#symptomSelectY'),
|
||||||
symptomVsSymptomChartViewElement: document.querySelector('#symptomVsSymptomChartView')
|
symptomVsSymptomChartViewElement: document.querySelector('#symptomVsSymptomChartView'),
|
||||||
|
downloadSymptomVsSymptomChartButton: document.querySelector("#downloadSymptomVsSymptomChart")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -40192,7 +40193,10 @@
|
|||||||
<option value="pH urine normal">pH urine normal</option>
|
<option value="pH urine normal">pH urine normal</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<canvas id="symptomVsSymptomChartView"></canvas>
|
<div>
|
||||||
|
<canvas id="symptomVsSymptomChartView"></canvas>
|
||||||
|
</div>
|
||||||
|
<button class="btn downloadButton" id="downloadSymptomVsSymptomChart">Download</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,12 +8,13 @@ class SymptomVsSymptomChartView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadAndDisplayChart(symptomX, symptomY) {
|
loadAndDisplayChart(symptomX, symptomY) {
|
||||||
Promise
|
return Promise
|
||||||
.all([symptomX, symptomY].map(symptom => PrrByVaccineProvider.getPrrByVaccine(symptom)))
|
.all([symptomX, symptomY].map(symptom => PrrByVaccineProvider.getPrrByVaccine(symptom)))
|
||||||
.then(
|
.then(
|
||||||
([prrByLotX, prrByLotY]) => {
|
([prrByLotX, prrByLotY]) => {
|
||||||
const { labels, data } = SymptomVsSymptomChartDataProvider.getChartData({ prrByLotX, prrByLotY });
|
const { labels, data } = SymptomVsSymptomChartDataProvider.getChartData({ prrByLotX, prrByLotY });
|
||||||
this.#displayChart(symptomX, symptomY, labels, data);
|
this.#displayChart(symptomX, symptomY, labels, data);
|
||||||
|
return { labels, data };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,15 @@ class SymptomVsSymptomChartViewInitializer {
|
|||||||
#symptomVsSymptomChartView;
|
#symptomVsSymptomChartView;
|
||||||
#symptomX;
|
#symptomX;
|
||||||
#symptomY;
|
#symptomY;
|
||||||
|
#batches;
|
||||||
|
#data;
|
||||||
|
#downloadSymptomVsSymptomChartButton;
|
||||||
|
|
||||||
configureSymptomVsSymptomChart(
|
configureSymptomVsSymptomChart(
|
||||||
{ symptomSelectXElement, symptomSelectYElement, symptomVsSymptomChartViewElement },
|
{ symptomSelectXElement, symptomSelectYElement, symptomVsSymptomChartViewElement, downloadSymptomVsSymptomChartButton },
|
||||||
initializeSelectElement) {
|
initializeSelectElement) {
|
||||||
|
|
||||||
|
this.#initializeButton(downloadSymptomVsSymptomChartButton);
|
||||||
this.#symptomVsSymptomChartView = new SymptomVsSymptomChartView(symptomVsSymptomChartViewElement);
|
this.#symptomVsSymptomChartView = new SymptomVsSymptomChartView(symptomVsSymptomChartViewElement);
|
||||||
{
|
{
|
||||||
initializeSelectElement(
|
initializeSelectElement(
|
||||||
@@ -37,8 +41,44 @@ class SymptomVsSymptomChartViewInitializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#loadAndDisplayChart() {
|
#loadAndDisplayChart() {
|
||||||
if (this.#symptomX != null && this.#symptomY != null) {
|
UIUtils.disableButton(this.#downloadSymptomVsSymptomChartButton);
|
||||||
this.#symptomVsSymptomChartView.loadAndDisplayChart(this.#symptomX, this.#symptomY);
|
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}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user