LineChart drawing value slightly higher than xAxis.axisMaximum
- Dominant language
- Swift
- Stars
- 28k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
As the title says, in a `LineChartView`, my dataSet has an entry drawn at the right edge that has an X value's pixel is `266.000000000521`. The `contentRect.size.origin + contentRect.size.width` is `266.0`. Said points should not be drawn because it is every so slightly over the maximum. Doing some tracing, `isInBoundsRight(_:)`in [ViewPortHandler.swift#L434](https://github.com/danielgindi/Charts/blob/master/Source/Charts/Utils/ViewPortHandler.swift#L434) has logic to manipulate the x, rounding the hundredth decimal place then minus-ing `1`. This manipulation resolves the x to `265.0` drawing the point.
Why is this manipulation needed? and how can I properly avoid this?
Contributor guide
Research direction
Start with Source/Charts/Utils/ViewPortHandler.swift around isInBoundsRight(_:) at line 434, then trace how LineChartView applies the right-bound check to plotted entries. Reproduce the reported floating-point boundary case and determine whether the existing rounding is intentional. Done means the boundary behavior and any needed change are covered by a verified result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100