Charts icon indicating copy to clipboard operation
Charts copied to clipboard

Fix bug in `XBounds` calculation of minimum/maximum visible entry index.

Open fumoboy007 opened this issue 2 years ago • 6 comments

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.

fumoboy007 avatar Jun 12 '22 23:06 fumoboy007

This conflicts with #4829 where I fixed the partitioningIndex algorithm change

FelixHerrmann avatar Jun 20 '22 13:06 FelixHerrmann

My PR might fix your whole problem as you can see in the screenshot below! Could you test my fork and confirm?

image

FelixHerrmann avatar Jun 20 '22 14:06 FelixHerrmann

@FelixHerrmann Cool! Confirmed that #4829 also partially fixes the XBounds calculation. However, I commented on part of the change, which I believe is incorrect.

fumoboy007 avatar Jun 21 '22 05:06 fumoboy007

Please merge this commit soon. thanks.

tri75 avatar Jul 12 '22 07:07 tri75

Hey all, any updates on merging this in? Love the library, awesome work on it!

lundjrl avatar Dec 20 '22 20:12 lundjrl

@lundjrl should be fixed with #4829

FelixHerrmann avatar Dec 20 '22 20:12 FelixHerrmann