HorizontalBarChartView value labels are absent if axisMinimum is not set to zero
- Dominant language
- Swift
- Stars
- 28k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
It seems to be a strange behavior in HorizontalBarCharRenderer. Without setting
`barChartView.leftAxis.axisMinimum = 0`
value labels are not shown.
I've investigated a bit and what I've found so far in my case.
`_contentRect.origin.x` is `10`.
`prepareMatrixValuePx()` is called with `0.1` for `chartXMin`, what leads to _`matrixValueToPx.tx = -6` and `barRect.origin.x = 4` after transformation.
And this all fails in `drawValues()` at
`if !viewPortHandler.isInBoundsX(rect.origin.x)`
, because `_contentRect.origin.x > rect.origin.x + 1`
The check's change to
`if !viewPortHandler.isInBoundsX(rect.origin.x + rect.size.width)`
also helps
Please advise whether this is a bug or just misusage of the library.
Contributor guide
Research direction
Start in HorizontalBarCharRenderer, following prepareMatrixValuePx() into drawValues() and the viewPortHandler bounds check. Reproduce the case with a nonzero axisMinimum, then verify that value labels remain visible when bars begin left of the content origin and add or update coverage if an existing test location is found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, swift
- Domain
- data-visualization, mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100