diff --git a/docs/HistogramChartView.js b/docs/HistogramChartView.js
new file mode 100644
index 00000000000..b885d61d331
--- /dev/null
+++ b/docs/HistogramChartView.js
@@ -0,0 +1,62 @@
+class HistogramChartView {
+
+ #canvas;
+ #chart;
+
+ constructor(canvas) {
+ this.#canvas = canvas;
+ }
+
+ displayChart(histoDescr) {
+ if (this.#chart != null) {
+ this.#chart.destroy();
+ }
+ this.#chart = new Chart(
+ this.#canvas,
+ {
+ type: 'bar',
+ data: this.#getData(histoDescr),
+ options: this.#getOptions()
+ });
+ }
+
+ // setData(data) {
+ // this.#chart.config.data.datasets[0].data = data;
+ // this.#chart.update();
+ // }
+
+ #getData(histoDescr) {
+ const { 'keys': symptoms, 'values': frequencies } = Utils.getKeysAlignedWithValues(histoDescr.histogram);
+ return {
+ labels: symptoms,
+ datasets: [{
+ label: histoDescr.batchcodes.join(', '),
+ data: frequencies
+ }]
+ };
+ }
+
+ #getOptions() {
+ return {
+ indexAxis: 'y',
+ responsive: true,
+ scales: {
+ y: {
+ title: {
+ display: true,
+ text: 'Symptom'
+ }
+ },
+ x: {
+ ticks: {
+ precision: 0
+ },
+ title: {
+ display: true,
+ text: 'Frequency'
+ }
+ }
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/docs/HistogramView.js b/docs/HistogramView.js
index d4f554f1050..6a5dd3f2ea7 100644
--- a/docs/HistogramView.js
+++ b/docs/HistogramView.js
@@ -31,42 +31,11 @@ class HistogramView {
#displayHistogram(histoDescr) {
// FK-TODO: brauchen Slider wie bei intensivstationen
- const canvas = UIUtils.createCanvas();
- this.#uiContainer.appendChild(canvas);
- const { 'keys': symptoms, 'values': frequencies } = Utils.getKeysAlignedWithValues(histoDescr.histogram);
- new Chart(
- canvas,
- {
- type: 'bar',
- data: {
- labels: symptoms,
- datasets: [{
- label: histoDescr.batchcodes.join(', '),
- data: frequencies
- }]
- },
- options: {
- indexAxis: 'y',
- responsive: true,
- scales: {
- y: {
- title: {
- display: true,
- text: 'Symptom'
- }
- },
- x: {
- ticks: {
- precision: 0
- },
- title: {
- display: true,
- text: 'Frequency'
- }
- }
- },
- }
- }
- );
+ // FK-TODO: extract class for template-chartWithSlider
+ const element = UIUtils.instantiateTemplate('template-chartWithSlider');
+ const canvas = element.querySelector("canvas");
+ this.#uiContainer.appendChild(element);
+ const histogramChartView = new HistogramChartView(canvas);
+ histogramChartView.displayChart(histoDescr);
}
}
\ No newline at end of file
diff --git a/docs/batchCodeTable.html b/docs/batchCodeTable.html
index 940f41b6655..6dca6dcd759 100644
--- a/docs/batchCodeTable.html
+++ b/docs/batchCodeTable.html
@@ -8,6 +8,13 @@
+
+
@@ -15,6 +22,7 @@
+