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

Vertical bar chart: capture of scrollView delegate callbacks and load additional data #920

Closed
nspassov opened this issue Apr 5, 2016 · 5 comments

Comments

@nspassov
Copy link

nspassov commented Apr 5, 2016

Hey guys,

I have a vertical bar chart. It has lots of data that doesn't fit the screen width so I have enabled scaling on the X axis. Is it possible to capture the scrollView offset when chart scaling is on as I would like to trigger a request for more data when the scrolling reaches the bounds of the chart?

@nspassov nspassov changed the title Enable scrolling in bar chart and capture of scrollView delegate callbacks Vertical bar chart: capture of scrollView delegate callbacks and load additional data Apr 5, 2016
@liuxuan30
Copy link
Member

it's a good quesiton. When you reach the end, you will know it's the last xIndex, and then you can add more data entries by addEntry.
you can take a look at how panGestureRecognized, performPanChange are implemented. It should be helpful. It does have a delegate called chartTranslated(chartView: ChartViewBase, dX: CGFloat, dY: CGFloat) so you know the offset.

@nspassov
Copy link
Author

nspassov commented Apr 6, 2016

The dX value that chartTranslated method gives is not the content offset like in a tableView, but something else. It is some kind of delta and this method also gets triggered when swiping that does not result in actual change of the position (swiping at the edge of the chart). This is what I am currently using but so far it doesn't quite do the job.

@liuxuan30
Copy link
Member

yes, it's not about content offset. You have to do some math to know if it reaches the end. It seems like this part can be improved in the future.

@shardul89
Copy link

shardul89 commented Mar 1, 2018

@liuxuan30 is there any specific methoid which gets called to load next set of chart data when chart reaches end of the scroll?

@liuxuan30
Copy link
Member

I don't remember, but maybe you can bind some methods from ViewPortHandler to see if possible.
Maybe highestVisibleX could help as well.

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

3 participants