-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Charts won't draw unless initialized with a frame #49
Comments
This probably falls into this as well, I appears as a chart won't accept any other frame than the one it has been initialised with. |
In ChartViewBase.swift there's a |
Sorry, just read your comment now. Is there a way to debug this from an Objective-C project? I can't look into the variables when I set a breakpoint in the code you've mentioned. |
Maybe println? On Wed, Apr 29, 2015 at 6:40 PM, AlBirdie notifications@github.com wrote:
|
Sorry for not getting back to your earlier Daniel, just got back in the office. I don't think this issue has been fixed by overriding frame instead of bounds. Just run the demo project with the latest source code, open the line chart demo and rotate the device. At first the viewport is getting stretched, but once you click into the chart (so that it reloads), it'll go back to its original frame. |
With the latest code it rotates fine in the demo :-)
There were a couple of fixes for this after the latest post - so you
probably aren't working with the latest code
|
Yes, somehow mixed up the code bases. :) So it does rotate. |
Are you sure you are not just having trouble with constraints and
autosizing?
|
Pretty sure, yes. I'm not even using a StoryBoard (nor layout constraints for that matter). _chartView = [[LineChartView alloc] initWithFrame:CGRectMake(20, 20, 200, 200)]; Then add a layoutSubViews and set a new frame; -(void) viewDidLayoutSubviews { Rotate the device and you'll see that the chart's frame does not take the new value. |
When initializing in IB, it's clear. But initWithFrame set it as nil - and combined with the default opaque=YES - it was filling the background with black.
Yes, this finally fixed it. 👍 |
It took me a while to figure this out, but I couldn't get the charts to draw unless the chart view was initialized with a frame.
There would be two solutions to this, either support changing the frame of the view or do something drastically like putting a fatalError() in the init() method, to prevent using that.
I might write a pull request with a fix, but at least it is reported now.
Best,
Simon
The text was updated successfully, but these errors were encountered: