Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

highestVisibleXIndex is smaller than lowestVisibleXIndex #940

Closed
lionhylra opened this issue Apr 12, 2016 · 8 comments · Fixed by #941
Closed

highestVisibleXIndex is smaller than lowestVisibleXIndex #940

lionhylra opened this issue Apr 12, 2016 · 8 comments · Fixed by #941
Labels

Comments

@lionhylra
Copy link

I just downloaded the demo app, adding one line _chartView.autoScaleMinMaxEnabled = YES; to the BarChartViewController.m at line:56.

And I run the demo app, and open the bar chart, zoom in. It crashes.
The screenshot:
screenshot
Back trace:
back trace

@lionhylra
Copy link
Author

I’ve added back trace.

On 12 Apr 2016, at 5:59 PM, Xuan notifications@github.com wrote:

send out the back trace, so we know where it crashes.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub #940 (comment)

@liuxuan30
Copy link
Member

you can simply post the text rather than image.
It crashes at BarChartDataSet.calcMinMax(), not highestVisibleXIndex is smaller than lowestVisibleXIndex
I'm adding a fix soon. It's simple, just use stride

@lionhylra
Copy link
Author

Yes, exactly. And in my own project, when I apply 'autoScaleMinMaxEnabled = true' to my bar chart, it crashes directly for the same reason.

liuxuan30 added a commit to liuxuan30/Charts that referenced this issue Apr 12, 2016
@lionhylra
Copy link
Author

In the screenshot above, the end value is smaller than start value in the for loop.

@lionhylra
Copy link
Author

I don't think changing 'for in range' to 'stride' will fix

liuxuan30 added a commit to liuxuan30/Charts that referenced this issue Apr 12, 2016
start may less than endValue
@liuxuan30
Copy link
Member

why not? I did a quick test, it won't crash then.

@liuxuan30
Copy link
Member

        _lastStart = start
        _lastEnd = end

        _yMin = yMin(entries[start])
        _yMax = yMax(entries[start])

        for i in start.stride(through: endValue, by: 1)
        {

if endValue < start, we won't step in the loop, and yMin, yMax is from entries[start]. So I think it is harmless.

@lionhylra
Copy link
Author

ok, I will try it later. Thanks

danielgindi added a commit that referenced this issue Apr 12, 2016
Fixes Xcode auto-migration fault, incorrect intervals (#940)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants