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

lowestVisibleXIndex never gets zero after zooming out #294

Closed
alinoz77 opened this issue Aug 11, 2015 · 1 comment
Closed

lowestVisibleXIndex never gets zero after zooming out #294

alinoz77 opened this issue Aug 11, 2015 · 1 comment

Comments

@alinoz77
Copy link

This problem is encountered with a LineChartView.

The problem is the float precision, after zooming in and out the lowestVisibleXIndex will 99% of the time return 1 when the chart is completely zoomed out.

Here is the code form BarLineChartViewBase.swift :

/// Returns the lowest x-index (value on the x-axis) that is still visible on he chart.
    public var lowestVisibleXIndex: Int
    {
        var pt = CGPoint(x: viewPortHandler.contentLeft, y: viewPortHandler.contentBottom)
        getTransformer(.Left).pixelToValue(&pt)
        return (pt.x <= 0.0) ? 0 : Int(pt.x + 1.0)
    }

pt.x will never be 0.0 but it will be something like 0.000000000001 and the index returned will be 1

@danielgindi
Copy link
Collaborator

This is not the case anymore... Closing!

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

2 participants