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

Is there any way to get the xaxis value when chart scroll end specific area? #2607

Closed
liaoyuanng opened this issue Jul 14, 2017 · 1 comment

Comments

@liaoyuanng
Copy link

Hi

First of all, thank you so much for this library.Charts is very great! Now,I meet a issue, I want to get the xaxis value when chart scrolling or scroll end,and this value is every point that across specific area.For example: I specific this area is chart center,I can get per ChartDataEntry instance when across this center area. I'm used "- chartTranslated:dX:dY",but it seems not work. Is there any way to get it?

Thank you.

@liuxuan30
Copy link
Member

there is something simiar I guess:

    /// - returns: The highest x-index (value on the x-axis) that is still visible on the chart.
    open var highestVisibleX: Double
    {
        var pt = CGPoint(
            x: viewPortHandler.contentRight,
            y: viewPortHandler.contentBottom)
        
        getTransformer(forAxis: .left).pixelToValues(&pt)

        return min(xAxis._axisMaximum, Double(pt.x))
    }

You can figure out what's your center and convert the pixel to values. Notice, it might fail or you have to search for closest values.

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