Skip to content

Commit cf8dd81

Browse files
committed
feat: Improve unit position on y-axis
1 parent 63ee20d commit cf8dd81

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/drawFunction.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,7 @@ function getTickCount(domain, { minDeltaY }) {
222222
return tickCount
223223
}
224224
225-
// TODO: Check why was avoiding needed. Condionally maybe?
226-
const avoidZeroAxisLabel = false
227225
function yFormat(value) {
228-
if (avoidZeroAxisLabel && value === 0) return ''
229226
const axisLabel = String(value)
230227
return axisLabel.length > yLabelMaxLength ? '' : axisLabel
231228
}
@@ -592,7 +589,10 @@ window.draw = (props) => {
592589
.style('color', dataset.axisColor ?? color)
593590
.style('font-size', '10px')
594591
.style('position', 'absolute')
595-
.style('bottom', margin.bottom - 5 + 'px')
592+
.style(
593+
'bottom',
594+
margin.bottom - 10 * (Math.floor(index / 2) + 1) + 'px'
595+
)
596596
.style(
597597
unitPositionKey,
598598
margin[unitPositionKey] + width + yLabelMargin + 'px'

0 commit comments

Comments
 (0)