Horizontal Bar Chart Bar Values not shown when only positive values in data set
- Dominant language
- Swift
- Stars
- 28k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
* [x] I've read, understood, and done my best to follow the [*CONTRIBUTING guidelines](https://github.com/jjatie/Charts/blob/master/CONTRIBUTING.md).
## What did you do?
Created simple Horizontal Bar Chart (within a UIScrollView) where values could be -ve or +ve (small integer values only).X labels set to text (to show on left-hand vertical axis)
## What did you expect to happen?
Expected bar values to be shown to the right (for positive values) or left (negative values) for each bar
## What happened instead?
If data set contains negative values, all values are show correctly beside their respective bar. If only positive values in data set, no values are shown by their bar
## Charts Environment
**Charts version/Branch/Commit Number:** 3.5.0
**Xcode version:** 11.6
**Swift version:** 5.2
**Platform(s) running Charts:** iOS 13.6
**macOS version running Xcode:** 10.15.6
## Analysis
When the buffers are created for the data set and converted to pixels, the x values for all buffers contains a value that is outside the x bounds of the viewport (within method drawValues in HorizontalBarChartRenderer)
e.g.
rect.origin.x = 50
_contentRect.origin.x = 76
if !viewPortHandler.isInBoundsX(rect.origin.x)
{
continue
}
is processed so value drawing is bypassed.
Contributor guide
Assessment
This issue has not been assessed yet.