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

Line chart in tableview cell #542

Closed
tahoecoop opened this issue Nov 9, 2015 · 4 comments
Closed

Line chart in tableview cell #542

tahoecoop opened this issue Nov 9, 2015 · 4 comments

Comments

@tahoecoop
Copy link

Hello, I am using a line chart in my tableview cells to show different data on each row. The tableview uses expanding cells that only shows the chart once user has tapped the row. I initially had the setChart: method being called in my cellForRowAtIndexPath:, but the performance was bad since it had to draw every chart. I then moved setChart: to didSelectRow: and the tableview performance is better. However the first cell I select, the chart doesn't show any data, although the data array exists. The chart does load the second time through, but the animation is off. It's almost like the setChart: method is being called when I collapse the cell, not when I tap it. Any help would be greatly appreciated!!

@liuxuan30
Copy link
Member

I am a little confused that you only draw one chart when you click the cell, it should not have performance issue, because you can click only one cell at a time; but you said you will draw all the chart..

Will you need to animate every chart in each cell? If true, then maybe performance impacted.

You might want to provide some images or video or code samples what you did in cellForItemAtIndexPath and didSelctedRow so we can understand what's going on...

I once had 10 UICollectionViewCells to display the chart, and the performance is acceptable thanks to the reusing cell technology. But even you see a drop, there are ways to improve it, like use UIImage cache not to draw every time if no data changed.

@tahoecoop
Copy link
Author

Thanks for the response. I am drawing different chart data in each cell, only to be displayed when user expands the cell. I'm using animation, which I'm sure is slowing it down. I posted some code on S.O. at this link if you want to check it out, thank you!

http://stackoverflow.com/questions/33618719/how-to-reset-ios-charts-animation-in-tableview-cell

@liuxuan30
Copy link
Member

OK, let's keep single thread for this. I will answer the SO since you had code there and close this

@BSATYAA
Copy link

BSATYAA commented Dec 15, 2019

How to display pia chart in table view cell swift

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