refactoring
This commit is contained in:
@@ -27,7 +27,7 @@ class FreeBedsChartView {
|
|||||||
label: 'Anteil freier Betten',
|
label: 'Anteil freier Betten',
|
||||||
data: data,
|
data: data,
|
||||||
parsing: {
|
parsing: {
|
||||||
yAxisKey: 'free_beds_divided_by_all_beds'
|
yAxisKey: 'free_beds_divided_by_all_beds_in_percent'
|
||||||
},
|
},
|
||||||
backgroundColor: 'rgba(0, 255, 0, 1)'
|
backgroundColor: 'rgba(0, 255, 0, 1)'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,11 +66,12 @@
|
|||||||
kreisText: selectedOption.text,
|
kreisText: selectedOption.text,
|
||||||
kreisValue: selectedOption.value
|
kreisValue: selectedOption.value
|
||||||
});
|
});
|
||||||
|
// FK-TODO: extract method
|
||||||
fetch(`data/intensivstationen/intensivstationen-${selectedOption.value}.json`)
|
fetch(`data/intensivstationen/intensivstationen-${selectedOption.value}.json`)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
for (const dataElement of json.data) {
|
for (const dataElement of json.data) {
|
||||||
dataElement.free_beds_divided_by_all_beds = dataElement.betten_frei / (dataElement.betten_frei + dataElement.betten_belegt) * 100;
|
dataElement.free_beds_divided_by_all_beds_in_percent = dataElement.betten_frei / (dataElement.betten_frei + dataElement.betten_belegt) * 100;
|
||||||
}
|
}
|
||||||
freeBedsChartView.displayChart({ data: json.data, title: selectedOption.text });
|
freeBedsChartView.displayChart({ data: json.data, title: selectedOption.text });
|
||||||
});
|
});
|
||||||
@@ -87,7 +88,7 @@
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
for (const dataElement of json.data) {
|
for (const dataElement of json.data) {
|
||||||
dataElement.free_beds_divided_by_all_beds = dataElement.betten_frei / (dataElement.betten_frei + dataElement.betten_belegt) * 100;
|
dataElement.free_beds_divided_by_all_beds_in_percent = dataElement.betten_frei / (dataElement.betten_frei + dataElement.betten_belegt) * 100;
|
||||||
}
|
}
|
||||||
freeBedsChartView.displayChart({ data: json.data, title: 'Alle Landkreise' });
|
freeBedsChartView.displayChart({ data: json.data, title: 'Alle Landkreise' });
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user