-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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 while selecting data point in zoomed state #3486
Comments
please take a look at
why please debug and provide more debug trace so we know where goes off. open override func computeAxis(min: Double, max: Double, inverted: Bool)
{
var min = min, max = max
if let transformer = self.transformer
{
// calculate the starting and entry point of the y-labels (depending on
// zoom / contentrect bounds)
if viewPortHandler.contentWidth > 10 && !viewPortHandler.isFullyZoomedOutX
{
let p1 = transformer.valueForTouchPoint(CGPoint(x: viewPortHandler.contentLeft, y: viewPortHandler.contentTop))
let p2 = transformer.valueForTouchPoint(CGPoint(x: viewPortHandler.contentRight, y: viewPortHandler.contentTop))
if inverted
{
min = Double(p2.x)
max = Double(p1.x)
}
else
{
min = Double(p1.x)
max = Double(p2.x)
}
}
}
computeAxisValues(min: min, max: max)
} please debug this function and print out all values that lead min/max to NaN |
I just put your code in computeAxis Function. but I can't find any bool named
My log before selection on selection and on crash as below,
All variables in the scope during the crash
Please let me know if these information is enough. Thanks for your support. |
This function I post is within the library... what you mean by What you should do is to add some break points before and after |
Yeah. I got what u meant now. I have checked the same and seems issue fixed by adding these lines of code into AxisRenderBase.swift at line 125
|
as I said, the point is to figure out how the NaN is created, not to avoid it after that. |
I think nan is created after some calculations done inside the charts library. I can give all the datasets given to charts when crash occurs. It will be great if you can tell me what is the purpose of using this interval property, so that I can debug the same code better Please let me know if need any further assistance to track issue. |
hmm, interval is used to calculate the proper 'interval' to use.. I don't remember very clearly, but the code should tell. Will you be able to know what number causes to NaN? We didn't need all data sets values, just what calculation leads to NaN |
Hi @Saranjithpk did you ever get anywhere with this? The best I can tell atm is that the point values by
Will continue to dig into how it got into this state and update as I learn more but if you've already made it out of the rabbit hole would appreciate any assistance! |
ok not sure if my case is the same as @Saranjithpk but I was able to trace it back to a mistake in my code that passed a Glad to have figured this out and would like to contribute something to hopefully keep others from falling into this same trap. @liuxuan30 given the info I've provided, I'm wondering if you think it makes more sense to enforce |
having this issue too. figured out that This happens because leftAxis is disabled and never configured. Not sure if this code should even be calculated if the axis is disabled. If i comment the line that disables leftAxis - no crash is occured. |
@liuxuan30 Any update on this ? |
What did you do?
ℹ I zoomed the charts and made a selection to one of the data point.
What did you expect to happen?
ℹ The delegate method with selected coordinates should be called.
What happened instead?
ℹ Crash happed.
Crash log:
Charts Environment
Charts version/Branch/Commit Number:3.0.4
Xcode version:9.2
Swift version:4
Platform(s) running Charts:iOS 11.3
macOS version running Xcode: 10.13.4
Demo Project
ℹ Please link to or upload a project we can download that reproduces the issue.
The text was updated successfully, but these errors were encountered: