Code Monkey home page Code Monkey logo

Comments (10)

AlBirdie avatar AlBirdie commented on July 30, 2024

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.
For instance, I initialize a chart with a frame of 0,0,50,50. Later in 'layoutSubviews' a new frame with new dimensions will be set. And even after manually calling 'setNeedsLayout / setNeedsDisplay' on the chart, it doesn't accept the new frame.
Anyone else experiencing this as well?

from charts.

danielgindi avatar danielgindi commented on July 30, 2024

In ChartViewBase.swift there's a bounds override, around line 750.
Could you please see if the viewport is actually updated there while
debugging?
I'm not on a Mac at the moment and perhaps we can make a quick fix now!

from charts.

AlBirdie avatar AlBirdie commented on July 30, 2024

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.

from charts.

danielgindi avatar danielgindi commented on July 30, 2024

Maybe println?
Or just a breakpoint to make sure it reaches there after resizing?
I know there are still some bugs when debugging Swift...

On Wed, Apr 29, 2015 at 6:40 PM, AlBirdie [email protected] wrote:

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.


Reply to this email directly or view it on GitHub
#49 (comment)
.

from charts.

AlBirdie avatar AlBirdie commented on July 30, 2024

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.

from charts.

danielgindi avatar danielgindi commented on July 30, 2024

from charts.

AlBirdie avatar AlBirdie commented on July 30, 2024

Yes, somehow mixed up the code bases. :) So it does rotate.
However, setting the frame manually (i.e. in ViewController's layoutSubviews) still won't work. The chart keeps the frame that has been set initially. This time I'm working with the latest code. ;) I've tried to debug this myself, but to be completely honest, I've got no idea why it isn't working.

from charts.

danielgindi avatar danielgindi commented on July 30, 2024

from charts.

AlBirdie avatar AlBirdie commented on July 30, 2024

Pretty sure, yes. I'm not even using a StoryBoard (nor layout constraints for that matter).
This is just a regular UIViewController with a chart added in code. In the viewcontroller's layoutSubviews I explicitly set the frame to the viewcontroller's frame, which won't have any effect.
You can even set a completely random frame in layoutSubviews (200 x 200 or something like that), and it won't resize the chart.
As a matter of fact, you can quite easily reproduce this bug by adapting the LineChart1ViewController by removing the LineChartView from the xib file and add it manually by code;

_chartView = [[LineChartView alloc] initWithFrame:CGRectMake(20, 20, 200, 200)];
[self.view addSubview:_chartView];

Then add a layoutSubViews and set a new frame;

-(void) viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
_chartView.frame = CGRectMake(20, 20, 500, 500);
}

Rotate the device and you'll see that the chart's frame does not take the new value.

from charts.

AlBirdie avatar AlBirdie commented on July 30, 2024

Yes, this finally fixed it. 👍
Thanks Daniel!

from charts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.