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

JBLineChartView doesn't resize its subviews #111

Closed
nicolasgoutaland opened this issue Sep 22, 2014 · 5 comments
Closed

JBLineChartView doesn't resize its subviews #111

nicolasgoutaland opened this issue Sep 22, 2014 · 5 comments

Comments

@nicolasgoutaland
Copy link

Hi,

when resized, JBLineChartView doesn't resizes its subviews (such as JBLineChartDotsView and JBLineChartLinesView).

A fix will be to add

    self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

in their constructors.
I think once resized, JBLineChartView should redraw its content, perhaps by adding a KVO on its frame ?

Regards,

@terryworona
Copy link
Collaborator

I've been getting around this by calling reloadData after a frame change.

See https://github.com/Jawbone/anscombe-quartet-ios for an example.

I could simply call reloadData after JBChartView's frame is set:

- (void)setFrame:(CGRect)frame
{
    [super setFrame:frame];
    [self reloadData];
}

Thoughts?

@terryworona
Copy link
Collaborator

Fixed in version 2.8.9 -- go ahead and give it a try.

@nicolasgoutaland
Copy link
Author

Seems good, but I don't think that reloading data when frame is updated is a good practice. It could be very time consuming, no ?

@terryworona
Copy link
Collaborator

reload data is fairly quick - it's just requesting data - no drawing taking place.

The UI loop will re-draw all the subviews regardless if reloadData is called or not; meaning the largest toll on performance is going to occur regardless.

@terryworona
Copy link
Collaborator

I rolled this fix back as our own personal projects seem to call setFrame quite often during touch events.

Rolled back via commit: efd8f97

For now, devs should just know to call reloadData after each frame change. I've added this to the documentation.

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

2 participants