Giter Club home page Giter Club logo

Comments (12)

ivnsch avatar ivnsch commented on May 28, 2024

Thanks. For what exactly do you want to use auto layout?

If it's for the chart's view, you can pass a view to the initializer instead of a frame. The view can come from a storyboard or a xib. You can use auto layout normally.

Note that you have to set the view's class to ChartBaseView (in the identity inspector).

from swiftcharts.

sniis84 avatar sniis84 commented on May 28, 2024

I added UIView in the storyboard setting class as ChartBaseView
@IBOutlet weak var viewArea: ChartBaseView!
Then
let chartFrame = viewArea.bounds
Finally
viewArea.addSubview(chart.view)

But it does not work, which method should I use? Thanks

from swiftcharts.

ivnsch avatar ivnsch commented on May 28, 2024

You have to pass viewArea to the chart:

let chart = Chart(
    view: viewArea,
    layers: [...]
)

And since viewArea is already in your view hierarchy, you don't have to add it again. chart.view is viewArea.

from swiftcharts.

sniis84 avatar sniis84 commented on May 28, 2024

I did that but I stop seeing axes and grid.
Possible?

from swiftcharts.

ivnsch avatar ivnsch commented on May 28, 2024

You are probably using the view before its frame is calculated. When you use auto layout this doesn't happen immediately. Try putting the chart initialization in viewDidLayoutSubviews. You will need a flag to check if it ran already because it's called multiple times. Here is a gist: https://gist.github.com/i-schuetz/f6e285eb0c86bb831510

Alternatively you can use viewDidAppear, which is called only once, but this happens a bit too late in the display process and there will be a noticeable delay.

from swiftcharts.

sniis84 avatar sniis84 commented on May 28, 2024

You closed this, but the question has not been solved!

from swiftcharts.

ivnsch avatar ivnsch commented on May 28, 2024

Since you stopped answering and opened a new issue where you recently implied that you see axis values (which solves your last comment) I assumed this was solved. What is missing?

from swiftcharts.

sniis84 avatar sniis84 commented on May 28, 2024

I solved the axis problem. But the auto layout has not been solved. As I've already replayed to your other link. Your tutorial about autolayout does not work properly. The image is stretched and not proportionally rotated.

Il giorno 14/ago/2015, alle ore 21:38, Ivan Schütz [email protected] ha scritto:

Since you stopped answering and opened a new issue where you recently mentioned that you see axis values (which solves your last comment) I assumed this was solved. What is missing?


Reply to this email directly or view it on GitHub.

from swiftcharts.

ivnsch avatar ivnsch commented on May 28, 2024

Which image? Rotation? Can you post a full example / description, maybe also a screenshot so I can get an idea of the problem?

from swiftcharts.

sniis84 avatar sniis84 commented on May 28, 2024

You can find full comments and pictures on the link you provided
https://gist.github.com/i-schuetz/f6e285eb0c86bb831510

Thanks

Il giorno 14/ago/2015, alle ore 23:03, Ivan Schütz [email protected] ha scritto:

Which image? Rotation? Can you post a full example / description, maybe also a screenshot so I can get an idea of the problem?


Reply to this email directly or view it on GitHub.

from swiftcharts.

ivnsch avatar ivnsch commented on May 28, 2024

Ok, the code was missing handling of rotation change. You didn't mention that you need this. I updated it. Now it resizes correctly. Note that you have the possibility to use different interval sizes depending of the orientation (in case you would for example want to show more x values, because there is more screen space available).

from swiftcharts.

sniis84 avatar sniis84 commented on May 28, 2024

Could be interesting to activate scroll on the xAxis only when landscape view is activated. I'll try to figure out on my own, in case I'll open a new question :)

from swiftcharts.

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.