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 axis #3081

Closed
balkarov opened this issue Dec 9, 2017 · 10 comments
Closed

Scrolling axis #3081

balkarov opened this issue Dec 9, 2017 · 10 comments

Comments

@balkarov
Copy link

balkarov commented Dec 9, 2017

Hello!

Thank you for your awesome library!

Is it possible implement scroll on Xaxis? With fixed left/right axis and legend?
I implemented with "hack": put chart view to UIScrollView. But left/right axis and legend scrolling too
:(

@liuxuan30
Copy link
Member

liuxuan30 commented Dec 12, 2017

it's already supported, as long as you zoom the chart in, only allow x scroll while disable Y. Just play with ChartsDemo. Like scaleXEnabled scaleYEnabled and more controls like setMaximumScaleY

@balkarov
Copy link
Author

balkarov commented Dec 12, 2017

@liuxuan30
Copy link
Member

scroll without zoom does not make sense, what you think?
scroll means you have more to display, while if you don't zoom, chart already displayed all data. What to scroll?
But you can set maxVisibleXRange etc first so it can scroll, but it's still zoomed behind the scene.

@balkarov
Copy link
Author

Did you see example?
I want set max visible data and see scroll.
For example: I set max xAxis data = 6, But my data has 100 values. And I will see scroll with first 6 values

@liuxuan30
Copy link
Member

liuxuan30 commented Dec 14, 2017

Did you see my answer? I said use setVisibleXRange It's not maxVisibleXRange, which I don't remember clearly, sorry about that. But if you search visible, it will give you some APIs to use

@balkarov
Copy link
Author

balkarov commented Apr 15, 2018

Hello.
This is does not work. Scroll (without zoom) does not work.
I want show scroll in chart without some zoom.

I set
[_chartView setVisibleXRangeWithMinXRange:0 maxXRange:6];

But I see all values

@balkarov
Copy link
Author

setVisibleXRange
/// Limits the maximum and minimum value count that can be visible by pinching and zooming.

But I want scroll without zooming

@pateljinal1844
Copy link

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

@badrinathvm
Copy link

@balkarov Can i see the code of adding the scrollView ?
@pateljinal1844 I tried setting setVisibleXRangeMaximum after the data is set , but still not able to scroll any working example i can have a look ?

@kevinrenskers
Copy link

I got it to work, but I want the chart to start scrolled all the way to the right. Is this possible? I have a bar chart with hundreds of bars, and I only want 14 of them visible at once.

chartView.xAxis.labelCount = valuesSet.count
chartView.dragXEnabled = true
chartView.data = BarChartData(dataSet: valuesSet)
chartView.setVisibleXRangeMaximum(14)

This makes it scroll, but it starts to the left.

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

5 participants