refactoring
This commit is contained in:
@@ -7,16 +7,19 @@ class HistogramView {
|
||||
}
|
||||
|
||||
displayHistogramsForBatchcode(batchcode) {
|
||||
// FK-TODO: zeige "Loading..." bis Daten geladen sind.
|
||||
fetch(`data/histograms/${batchcode}.json`)
|
||||
.then(response => response.json())
|
||||
.then(histoDescr => {
|
||||
const canvas = document.createElement("canvas");
|
||||
this.#uiContainer.appendChild(canvas);
|
||||
this.#displayChart(histoDescr, canvas);
|
||||
.then(histoDescrs => {
|
||||
for (const histoDescr of histoDescrs.histograms) {
|
||||
const canvas = document.createElement("canvas");
|
||||
this.#uiContainer.appendChild(canvas);
|
||||
this.#displayHistogram(histoDescr, canvas);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#displayChart(histoDescr, canvas) {
|
||||
#displayHistogram(histoDescr, canvas) {
|
||||
// FK-TODO: brauchen Slider wie bei intensivstationen
|
||||
new Chart(
|
||||
canvas,
|
||||
@@ -24,8 +27,9 @@ class HistogramView {
|
||||
type: 'bar',
|
||||
data: {
|
||||
datasets: [{
|
||||
label: histoDescr.batchcode,
|
||||
data: histoDescr.histograms[0].histogram
|
||||
// FK-TODO: alle histoDescr.batchcodes zu einem String zusammenfassen
|
||||
label: histoDescr.batchcodes[0],
|
||||
data: histoDescr.histogram
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user