Comments (12)
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.
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.
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.
I did that but I stop seeing axes and grid.
Possible?
from swiftcharts.
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.
You closed this, but the question has not been solved!
from swiftcharts.
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.
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.
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.
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.
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.
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)
- Static library
- Temporarily hide lines in Line chart
- What's the correct way to set contentView background color and border? HOT 1
- Is this kind of y axis layout possible:
- Extending Views to create custom views isn't working due to file private and internal properties
- How to overlay a layer of labels?
- Axis disappear after coming back from background
- X Y points in horizontal bar chart keeps moving rights; when the y axis labels length (text) is more
- Swift 5
- Changing axis values
- X values not adding properly
- Axis Labels not showing up HOT 2
- ChartLabelSettings() ignoring supplied font color, always defaults to black HOT 1
- SPM Support?
- Problem building on new MacBook
- SPM not working properly due to missing TAG HOT 1
- x, y Axis didn't show in the Chart HOT 2
- ChartPointsBubbleLayer not draws properly HOT 1
- how to dynamic live update line chart
- How can i make xAxisLabel to get multiple data instead of one value for one xAxisLabel ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftcharts.