From b797d210c5a14eb1693d092523648d3141be308e Mon Sep 17 00:00:00 2001 From: frankknoll Date: Sat, 28 Jan 2023 16:18:19 +0100 Subject: [PATCH] refactoring --- docs/HistogramView.js | 25 +++++++++++++++++++++++++ docs/batchCodeTable.html | 1 + docs/batchCodeTable.js | 21 ++------------------- 3 files changed, 28 insertions(+), 19 deletions(-) create mode 100644 docs/HistogramView.js diff --git a/docs/HistogramView.js b/docs/HistogramView.js new file mode 100644 index 00000000000..ecfc835da0a --- /dev/null +++ b/docs/HistogramView.js @@ -0,0 +1,25 @@ +class HistogramView { + + constructor() { + } + + show(batchcode, div) { + fetch(`data/histograms/${batchcode}.json`) + .then(response => response.json()) + .then(json => { + const data = json.histograms[3].histogram; + new Chart( + div.querySelector('#symptomByBatchcodeHisto'), + { + type: 'bar', + data: { + datasets: [{ + label: 'Acquisitions by year', + data: data + }] + } + } + ); + }); + } +} \ No newline at end of file diff --git a/docs/batchCodeTable.html b/docs/batchCodeTable.html index 03d8e35204d..6af4dc458d5 100644 --- a/docs/batchCodeTable.html +++ b/docs/batchCodeTable.html @@ -11,6 +11,7 @@ +