refactoring

This commit is contained in:
frankknoll
2023-01-28 16:42:11 +01:00
parent 70f213978d
commit 4c79d50a4a

View File

@@ -6,22 +6,26 @@ class HistogramView {
show(batchcode, uiContainer) {
fetch(`data/histograms/${batchcode}.json`)
.then(response => response.json())
.then(json => {
const data = json.histograms[3].histogram;
.then(histoDescr => {
const canvas = document.createElement("canvas");
uiContainer.appendChild(canvas);
new Chart(
canvas,
{
type: 'bar',
data: {
datasets: [{
label: 'Acquisitions by year',
data: data
}]
}
}
);
this.#displayChart(histoDescr, canvas);
});
}
#displayChart(histoDescr, canvas) {
// FK-TODO: brauchen Slider wie bei intensivstationen
new Chart(
canvas,
{
type: 'bar',
data: {
datasets: [{
label: histoDescr.batchcode,
data: histoDescr.histograms[0].histogram
}]
}
}
);
}
}