Skip to content
Snippets Groups Projects
Commit 45da01ba authored by mashazyu's avatar mashazyu
Browse files

Fixes bug when .8 and .3 labels are not shown in chart

parent 77908afd
No related branches found
No related tags found
No related merge requests found
......@@ -44,25 +44,19 @@ export function getTickList(columnHeight) {
return getTickPositions(columnHeight).map((tickPosition, i) => {
const tick = scaleMax - i * unit
let isBold, label, shouldShowLabel
if (Number.isInteger(tick)) {
isBold = true
label = tick.toString() + '.0'
} else {
isBold = false
label = tick.toString()
}
const isBold = Number.isInteger(tick) ? true : false
const label = tick.toFixed(1)
let shouldShowLabel
// when temp range <= 2, units === 0.1 we show temp values with step 0.2
// when temp range > 2, units === 0.5 we show temp values with step 0.5
if (unit === 0.1) {
// show label with step 0.2
shouldShowLabel = !(tick * 10 % 2)
shouldShowLabel = !(label * 10 % 2)
} else {
// show label with step 0.5
shouldShowLabel = !(tick * 10 % 5)
shouldShowLabel = !(label * 10 % 5)
}
// don't show label, if first or last tick
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment