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

Add bar/line caching for only visible content. #61

Closed
ivansher opened this issue May 21, 2014 · 5 comments
Closed

Add bar/line caching for only visible content. #61

ivansher opened this issue May 21, 2014 · 5 comments

Comments

@ivansher
Copy link

Table method is called for 'view' (barChartView: barViewAtIndex:) only visible cells. Currently data is loaded completely. Because it requires a lot of memory.

JBBarChartView -> UIView -> UIScrollView

Succinctly:
JBBarChartView *jbChartView = [[JBBarChartView alloc] init];
UIView *chartView = [[UIView alloc] init];
[chartView addSubview:jbChartView];
UIScrollView *chartScrollView = [[UIView alloc] init];
[chartScrollView addSubview:chartView];

@terryworona
Copy link
Collaborator

Is the suggestion to move the chart over to a UIScrollView s.t. bars/line segments can be paginated and only requested when on screen?

@ivansher
Copy link
Author

If I understand you correctly.
I added JBBarChartView in UIScrollView without UIViev, but the method "barChartView: barViewAtIndex:" called for all bars (such as 200), though the screen only displays 7.
UIScrollView added through IB.

jbChartView = [[JBBarChartView alloc] init];
[jbChartView setDataSource:self];
[jbChartView setDelegate:self];
[jbChartView setFrame:CGRectMake(0, 0, barSize * scale, chartScrollView.frame.size.height * .8)];
[chartScrollView setContentSize:jbChartView.frame.size];
[chartScrollView addSubview:jbChartView];
[jbChartView reloadData];

@terryworona
Copy link
Collaborator

Yes, the chart view will ask for every single bar at once; there is no caching or paging of bars that are on/off the screen.

Placing the chart on a scroll view has no effect since the chart instance has no idea about the scroll view or that some portion of it is on/off the screen.

Making this as an enhancement; it's something to consider in the future.

@terryworona terryworona changed the title Processing 'cell' as in Table. Add bar/line caching for only visible content. May 22, 2014
@khoogheem
Copy link

The ability to scroll would be great!!! Looking at using this to show live data.. so the concept of scrolling would be nice to have..

What I am doing right now to simulate a scroll is to just remove the first index after X data points are in the array...

@terryworona
Copy link
Collaborator

It's unlikely this will become a reality. The chart simply wasn't intended to show a live stream of (scrollable) data. Much of the underlying architecture would need to be changed.

We haven't had a lot of requests for this functionality, so until we get more, I'm going to curb this request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants