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

App is crashing for certain symbols when granularityEnabled is false #1181

Closed
rsarker opened this issue Jun 27, 2016 · 3 comments
Closed

App is crashing for certain symbols when granularityEnabled is false #1181

rsarker opened this issue Jun 27, 2016 · 3 comments

Comments

@rsarker
Copy link

rsarker commented Jun 27, 2016

In ChartYAxisRenderer line 92 (iOS Charts v-2.2.5) (granularityEnabled is false),

let intervalMagnitude = ChartUtils.roundToNextSignificant(number: pow(10.0, floor(log10(interval))))
        let intervalSigDigit = (interval / intervalMagnitude)
        if (intervalSigDigit > 5)
        {
            // Use one order of magnitude higher, to avoid intervals like 0.9 or 90
            interval = floor(10.0 * intervalMagnitude)
        }

We are checking intervalSigDigit > 5, not sure where this value 5 is coming from, please provide some details about that if you can.
Now if for any reason (that is what happening to me) intervalMagnitude is less than 0.1 (let's say 0.06) and the intervalSigDigit is greater than 5 then we make the interval to be, floor(10.0 * 0.06) = 0. Now if forceLabels is not enabled then we calculate first and last value where we use that interval value (which is now 0) as the divisor and it results in NaN and causes the app to crash.
I can prevent the crash by checking if the floor(10.0 * intervalMagnitude) is 0 then skip using it or just set interval to 0.01 when floor(10.0 * intervalMagnitude) is 0. But I'm not sure if that is the correct way of doing it. Please respond if you get what I'm trying to explain and you have a better solution for it.

Thanks.

@liuxuan30
Copy link
Member

it seems not easy to tell what's wrong, any steps could reproduce? granularityEnabled is false is the default behavior I think

@liuxuan30 liuxuan30 added the bug label Jun 30, 2016
@danielgindi
Copy link
Collaborator

Please test this on Charts 3.0.

@liuxuan30 liuxuan30 added the task label Aug 12, 2016
@danielgindi
Copy link
Collaborator

I couldn't reproduce this on Charts 3.0, it anyone experiences this - please re-open the issue.

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

No branches or pull requests

3 participants