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

Crash on the function isDrawingValuesAllowed #3772

Closed
1 task done
nijoshjose opened this issue Dec 6, 2018 · 5 comments
Closed
1 task done

Crash on the function isDrawingValuesAllowed #3772

nijoshjose opened this issue Dec 6, 2018 · 5 comments

Comments

@nijoshjose
Copy link

nijoshjose commented Dec 6, 2018

What did you do?

ℹ I'm adding points around 50 or more in the line chart. The points are placed adjacent to another point and space between point is less. After that, I'm clicking on any points it becomes crash.

What did you expect to happen?

I want to run my application smoothly without the crash.

What happened instead?

ℹ I got crash from this line

return data.entryCount < Int(CGFloat(dataProvider?.maxVisibleCount ?? 0) * viewPortHandler.scaleX)

in this line CGFloat(dataProvider?.maxVisibleCount ?? 0) * viewPortHandler.scaleX it become infinity.
here is the full function

@objc open func isDrawingValuesAllowed(dataProvider: ChartDataProvider?) -> Bool
    {
        guard let data = dataProvider?.data else {
            return false
        }
        return data.entryCount < Int(CGFloat(dataProvider?.maxVisibleCount ?? 0) * viewPortHandler.scaleX)
    }

So what i'm supposed to do?

Charts Environment

Charts version: 3.1.1
Xcode version: 10.1
Swift version: 4.2
macOS version running Xcode: macOS Mojave (10.14.1)

@dtmp
Copy link

dtmp commented Aug 29, 2019

@nijoshjose ran into a similar problem. managed to find a solution?

@dtmp
Copy link

dtmp commented Aug 29, 2019

in my case, the error was related to trying to set visibleXRangeMaximum to an empty dataset

@TalibDev
Copy link

I am getting this crash when I use the charts for a longer time, like zooming in and zooming out multiple times, does anyone found any solution? @dtmp @nijoshjose @

@alimumtaz
Copy link

anyone resolved this issue?

@elericuz
Copy link

hi @alimumtaz, it seems that you have to give a value for setMaximumScaleX as well as the maxVisibleCount. It worked for me.

chartView.maxVisibleCount = 30
chartView.viewPortHandler.setMaximumScaleX(CGFloat(1.5))

hope it work for you too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants