diff --git a/docs/batchCodeTable.html b/docs/batchCodeTable.html index 7b78df55254..a9a039ea1a4 100644 --- a/docs/batchCodeTable.html +++ b/docs/batchCodeTable.html @@ -1,16 +1,19 @@ + - - -Batch Codes of Coronavirus 2019 Vaccines - - - - - - - + + + + + -Fork me on GitHub -

Batch Codes of Coronavirus 2019 Vaccines

-

- -

-

-

-Check out your batch code (Last updated: January 13, 2023) + Fork me on GitHub +

Batch Codes of Coronavirus 2019 Vaccines

+

+

- - - - - - - - - - - - - - -
BatchAdverse Reaction ReportsDeathsDisabilitiesLife Threatening IllnessesCompanyCountriesSevere reportsLethality
-

Data Source: -Vaccine Adverse Event Reporting System +

+

+ Check out your batch code (Last updated: January 13, 2023) +

+ + + + + + + + + + + + + + + +
BatchAdverse Reaction ReportsDeathsDisabilitiesLife Threatening IllnessesCompanyCountriesSevere reportsLethality
+

Data Source: + Vaccine Adverse Event Reporting System (VAERS) -

+

+ \ No newline at end of file diff --git a/docs/batchCodeTable.js b/docs/batchCodeTable.js index 48b3ad0372f..43c831eb1f2 100644 --- a/docs/batchCodeTable.js +++ b/docs/batchCodeTable.js @@ -15,19 +15,58 @@ class BatchCodeTableInitializer { this.#batchCodeTable = this.#createEmptyBatchCodeTable(); this.#countrySelect.addEventListener('change', event => this.#displayCountry(event.target.value)); this.#displayCountry('Global') + function format(d) { + const div = document.createElement("div"); + const canvas = document.createElement("canvas"); + canvas.setAttribute("id", "acquisitions"); + div.appendChild(canvas); + return div; + } + const thisClassInstance = this; + $('#' + this.#batchCodeTableElement[0].id + ' tbody').on( + 'click', + 'td.dt-control', + function () { + const tr = $(this).closest('tr'); + const row = thisClassInstance.#batchCodeTable.row(tr); + if (row.child.isShown()) { + row.child.hide(); + tr.removeClass('shown'); + } else { + const div = format(row.data()); + row.child(div).show(); + new Chart( + div.querySelector('#acquisitions'), + { + type: 'bar', + data: { + datasets: [{ + label: 'Acquisitions by year', + data: { + "Circulatory collapse": 1, + "Hyperhidrosis": 4 + } + }] + } + } + ); + tr.addClass('shown'); + } + }); } #createEmptyBatchCodeTable() { const columnIndex = { - 'Batch': 0, - 'Adverse Reaction Reports': 1, - 'Deaths': 2, - 'Disabilities': 3, - 'Life Threatening Illnesses': 4, - 'Company': 5, - 'Countries': 6, - 'Severe reports': 7, - 'Lethality': 8 + 'control': 0, + 'Batch': 1, + 'Adverse Reaction Reports': 2, + 'Deaths': 3, + 'Disabilities': 4, + 'Life Threatening Illnesses': 5, + 'Company': 6, + 'Countries': 7, + 'Severe reports': 8, + 'Lethality': 9 }; return this.#batchCodeTableElement.DataTable( { @@ -44,6 +83,13 @@ class BatchCodeTableInitializer { order: [[columnIndex['Adverse Reaction Reports'], "desc"]], columnDefs: [ + { + className: 'dt-control', + orderable: false, + data: null, + defaultContent: '', + targets: columnIndex['control'] + }, { searchable: false, targets: [