Comments (7)
Can you please provide a self contained example (as text, maybe as a gist)? Don't see the problem in your code. Are you working with the example's code or are there other differences? If it's drawing the line correctly but not the axes it's likely something with the view, not the model data.
from swiftcharts.
Here a pastebin, and yhea that's what i though with the view. How can the view influence this, do you have more details? http://pastebin.com/V9zKnL7N
It's not the direct example, but it's really close, and i don't think there are any big errors, must be the view. Is it possible to resize the graphic so it doesnt take full view space? Or may it be what precisely make it crash?
Thanks for your answer
Edit: made some cleaning: Here is the code snippet generated graph (with static data, not my json points), inside an empty view. Nothing fancy :/ but still fail. http://imgur.com/PKvmzaL
And reducing the complexity possibilities, the problem is the same with a simpler chart:
http://pastebin.com/p55VPQ6r result http://imgur.com/bPDMScz
Edit 2: tried again everything from scratch, with fresh new view, the basic code, impossible to have anything else that the plot lines :/ I don't get it, must be on my side but... What do you have with the previous code?
I am using the NON-swift2.0 version
from swiftcharts.
The snippets are still missing the context... Is your view's size already computed when you call getChartFrame? Somebody who was using autolayout had similar issues, see #30, here the solution: https://gist.github.com/i-schuetz/f6e285eb0c86bb831510
Otherwise start with one of the examples and edit it until you can reproduce it, so we know what exactly is causing the issue. If nothing helps please either post the full code, or upload somewhere a project where the issue is reproduced and I'll take a look.
from swiftcharts.
I think it's on my side, let me spend more time on it before sharing it. Thanks a lot anyway. I keep this open and keep you updated.
And yhea my view is already computed, I mean i have a view with 2 date pickers, and when the user pick the 2 dates then the chart is rendered
ps: getChartView is the same as in your examples:
func getChartFrame(containerBounds: CGRect) -> CGRect { return CGRectMake(0, 70, containerBounds.size.width, containerBounds.size.height - 70) }
from swiftcharts.
I am becoming crazy... I don't understand why it won't work. I can use the simplest example, yet I never saw any x or y axis bars. My project is on github, files PowermonitorIOS/viewcontrollers/ChartVC.swift, if you wanna check. I reinstalled SwiftCharts, I deleted my files and recreated them. I don't know what to do
EDIT: Found IT! I didn't used
self.chart = chart
and the var chart
Can you explain me how it could have such impact? Is it keeping track of the layers?
from swiftcharts.
The chart has to be referenced, otherwise it's released, and when ChartBaseView
calls drawRect
on it (which is used to draw the axes) the reference is nil. ChartBaseView
doesn't have a strong reference to Chart
because otherwise it would cause a reference cycle...
This is also why there's an "arc" comment next to the chart declaration in the examples.
This is admittedly a bit cumbersome, may change the architecture in the future to prevent it. A possibility would be to implement the chart directly as view, which is always retained. Right now I'm not sure though if this works nicely with the way the library is designed.
Sorry for not thinking about this before, I actually also had this issue before adding the instance variables, but totally forgot.
from swiftcharts.
It's totally fine, you just share you API and I should check everything more carefully. Anyway, thanks for SwiftCharts! It's great
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.