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 Observed when AxisRenderer interval is becoming NaN #2168

Closed
ghost opened this issue Feb 15, 2017 · 17 comments
Closed

Crash Observed when AxisRenderer interval is becoming NaN #2168

ghost opened this issue Feb 15, 2017 · 17 comments

Comments

@ghost
Copy link

ghost commented Feb 15, 2017

I have a chart graph and based upon Segment Controller, We change the value of graph. When the axis graphs values are changed and segment is changed, the zoom level remains the same as it was earlier zoomed to. The following line is crashing in AxisRendererBase.swift since variable are becoming NaN.
let intervalSigDigit = Int(interval / intervalMagnitude)
My Chart Release shows following in Lock file

  • Charts (3.0.1):
    • Charts/Core (= 3.0.1)
@ghost
Copy link
Author

ghost commented Feb 15, 2017

This is one of the lldb log: fatal error: Double value cannot be converted to Int because it is either infinite or NaN

@liuxuan30
Copy link
Member

need more info why some of the values become NaN or inf.

@ghost
Copy link
Author

ghost commented Feb 22, 2017

Not sure. I am just using the API and it was crashing on this If in near future I get to reproduce I will surely paste the info. As of now I would like someone to fix it for invalid values. Any help would be appreciated.

@liuxuan30
Copy link
Member

yep but we need more info on how this happens

@capecrawler
Copy link

Also getting few crashes from fabric that is somehow related to this.

screen_shot_2017-04-20_at_10_58_43_am

@liuxuan30
Copy link
Member

are you having same issue as in #2356?

@capecrawler
Copy link

I am not sure since I was not able to replicate this crash and it points to different line of code which is let intervalSigDigit = Int(interval / intervalMagnitude). My guess is that intervalMagnitude value is 0.0 or NaN that is causing the crash.

@liuxuan30
Copy link
Member

liuxuan30 commented Apr 21, 2017

that's weird, I need to know when

let intervalMagnitude = ChartUtils.roundToNextSignificant(number: pow(10.0, Double(Int(log10(interval)))))

will make intervalMagnitude zero. I don't see obvious number will do so.

@josman185
Copy link

Hello @liuxuan30 , @danielgindi
I'm getting an error in line 125: fatal error: Double value cannot be converted to Int because it is either infinite or NaN

this is the line: let intervalMagnitude = ChartUtils.roundToNextSignificant(number: pow(10.0, Double(Int(log10(interval)))))

please if you have any suggestions I'll be very thankful.

here you have more data:
captura de pantalla 2017-06-16 a las 19 28 41

@liuxuan30
Copy link
Member

Can you check if #2377 fix the issue? It has been sometime and I don't remember if they are the same.

@atalayasa
Copy link

@josman185hotm did you solve your issue ?

@liuxuan30
Copy link
Member

closing now. reopen with updates

@jessicamecht
Copy link

jessicamecht commented Apr 2, 2019

The same thing happened for me when dismissing a viewController and returning to the view that included the chart in

let intervalMagnitude = pow(10.0, Double(Int(log10(interval)))).roundedToNextSignficant()

Edit:
I dug a little deeper into the problem, and it seems that it only appears when I set setVisibleXRangeMaximum in the viewDidLoad (I changed it to be called in the viewWillAppear and it did not crash any more).

It seems that the Transformers valueToPixelMatrix is producing the nan value but right now I do not know where I might be missing setting this, since all my Charts logic is in one place and in all the other cases do not crash (when presenting the vc).

@ivan-pavliuk
Copy link

Hello. The same crash!

STR:

  1. Zoom in the chart
  2. Change count lines in the chart (update LineChartView.data value with new points)

@ivan-pavliuk
Copy link

The solution for me:
set self.chartView.zoom(scaleX: 0, scaleY: 0, x: 0, y: 0) when updating the chart

@laurenyew-ua
Copy link

Hitting this crash as well.
let intervalMagnitude = pow(10.0, Double(Int(log10(interval)))).roundedToNextSignficant()
let intervalSigDigit = Int(interval / intervalMagnitude)
is crashing. intervalMagnitude is coming back as NaN.

@ciumexan
Copy link

same here... i think is related to the interval value not getting the default (minimal) init.
So the "interval" is nil.

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

8 participants