Fix bug in XBounds calculation of minimum/maximum visible entry index.#4839
Open
fumoboy007 wants to merge 1 commit intoChartsOrg:masterfrom
Open
Fix bug in XBounds calculation of minimum/maximum visible entry index.#4839fumoboy007 wants to merge 1 commit intoChartsOrg:masterfrom
XBounds calculation of minimum/maximum visible entry index.#4839fumoboy007 wants to merge 1 commit intoChartsOrg:masterfrom
Conversation
`XBounds` looks for data entries on the boundary of or outside of the visible range. However, there may not be any such entries for a particular data set. Imagine a chart with two data sets, one of which has a bigger range of x-values than the other. The chart’s zoomed-out visible range would be the range of the wider data set. When the renderer tries to render the narrower data set, it would fail to correctly calculate the starting and ending entry indices because the starting/ending entries are strictly inside of the visible range. The fix is to add fallback logic to look for data entries inside of the visible range if the initial algorithm does not find anything. The `XBounds` bug fix also requires a bug fix in `ChartDataSet`’s binary search algorithm.
k1ran-ak
reviewed
Jun 17, 2022
k1ran-ak
left a comment
There was a problem hiding this comment.
Reviewed. No crashes. I didn't see any Lower bound <= upper bound errors anymore
Contributor
|
This conflicts with #4829 where I fixed the partitioningIndex algorithm change |
Contributor
|
My PR might fix your whole problem as you can see in the screenshot below! Could you test my fork and confirm? |
Author
|
@FelixHerrmann Cool! Confirmed that #4829 also partially fixes the |
|
Please merge this commit soon. thanks. |
Joe-BOD
pushed a commit
to beachbodydigital/Charts
that referenced
this pull request
Aug 2, 2022
* Update for the two fixes in PR now for Charts * Swift 5.7 - ChartsOrg#4874 * XAxis beyond Chart Dataset - ChartsOrg#4839
|
Hey all, any updates on merging this in? Love the library, awesome work on it! |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

XBoundslooks for data entries on the boundary of or outside of the visible range. However, there may not be any such entries for a particular data set.Imagine a chart with two data sets, one of which has a bigger range of x-values than the other. The chart’s zoomed-out visible range would be the range of the wider data set. When the renderer tries to render the narrower data set, it would fail to correctly calculate the starting and ending entry indices because the starting/ending entries are strictly inside of the visible range.
The fix is to add fallback logic to look for data entries inside of the visible range if the initial algorithm does not find anything.
The
XBoundsbug fix also requires a bug fix inChartDataSet’s binary search algorithm.