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

Scrolling of bar chart is not working initially. #3532

Closed
NPhadtare opened this issue Jun 25, 2018 · 7 comments
Closed

Scrolling of bar chart is not working initially. #3532

NPhadtare opened this issue Jun 25, 2018 · 7 comments

Comments

@NPhadtare
Copy link

I create a bar chart using using this library. and want to show minimum 7 bars initially. But show all data at once after load. Please help me to achieve this.

@nastassia-kavaliova
Copy link

Try this:

chartView.xAxis.labelCount = 7

@asheesh-gupta-kranti
Copy link

We are facing the same issue, we want to show only 4 bars and want to have scroller to scroll for rest of the bars. Is there any way to do this?

@nastassia-kavaliova
Copy link

@asheesh-gupta-kranti have you tried setting labelCount property?
chartView.xAxis.labelCount = 4

@asheesh-gupta-kranti
Copy link

Yes, I have but it's only changing the number of labels not the number of bars.

@liuxuan30
Copy link
Member

please ask on stack ovreflow next time.

This, time, it should be

    /// Sets the size of the area (range on the x-axis) that should be minimum visible at once (no further zooming in allowed).
    ///
    /// If this is e.g. set to 10, no less than a range of 10 values on the x-axis can be viewed at once without scrolling.
    ///
    /// If you call this method, chart must have data or it has no effect.
    @objc open func setVisibleXRangeMinimum(_ minXRange: Double)
    {
        let xScale = _xAxis.axisRange / minXRange
        _viewPortHandler.setMaximumScaleX(CGFloat(xScale))
    }

@pateljinal1844
Copy link

I just found out, ordering matters for this to work. You need to call setVisibleXRangeMaximum after chartView.data = data or notifyDataSetChanged

@CavalcanteLeo
Copy link

CavalcanteLeo commented Jun 30, 2022

dude, @pateljinal1844 , i was like an hour crying because it wasn't working, shit, there is no doc at all.

You saved me, fucking order

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

6 participants