Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Verbesserung für Graphen. #104

Merged
merged 1 commit into from
Dec 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions incidence.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ class UI {
let context = new DrawContext()
context.size = new Size(width, height)
context.opaque = false
context.respectScreenScale = true
let max = Math.max.apply(Math, graphData.map(function (o) { return o.cases; }))
max = (max <= 0) ? 10 : max;
let w = Math.max(2, Math.round((width - (graphData.length * 2)) / graphData.length))
Expand All @@ -385,7 +386,7 @@ class UI {
let item = graphData[i]
let value = parseFloat(item.cases)
if (value === -1 && i == 0) value = 10;
let h = Math.max(2, Math.round((Math.abs(value) / max) * height))
let h = Math.max(2, (Math.abs(value) / max) * height)
let x = xOffset + (w + 1) * i
let rect = new Rect(x, height - h, w, h)
context.setFillColor(UI.getIncidenceColor((item.cases >= 1) ? item.incidence : 0))
Expand All @@ -398,6 +399,7 @@ class UI {
let context = new DrawContext()
context.size = new Size(width, height)
context.opaque = false
context.respectScreenScale = true
let max = Math.max.apply(Math, graphData.map(function (o) { return o.incidence; }))
let min = Math.min.apply(Math, graphData.map(function (o) { return o.incidence; })) / 1.2
max = (max <= 0) ? 10 : max - min;
Expand All @@ -407,7 +409,7 @@ class UI {
let item = graphData[i]
let value = parseFloat(item.incidence) - min
if (value === -1 && i == 0) value = 10;
let h = Math.max(2, Math.round((Math.abs(value) / max) * (height - 1)))
let h = Math.max(2,(Math.abs(value) / max) * (height - 1))
let x = xOffset + (w + 1) * i
let rect = new Rect(x, height - h - 1, w, h)
context.setFillColor(UI.getIncidenceColor((item.cases >= 1) ? item.incidence : 0))
Expand Down