Giter Club home page Giter Club logo

Comments (7)

ivnsch avatar ivnsch commented on June 7, 2024

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.

 avatar commented on June 7, 2024

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.

ivnsch avatar ivnsch commented on June 7, 2024

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.

 avatar commented on June 7, 2024

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.

 avatar commented on June 7, 2024

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.

ivnsch avatar ivnsch commented on June 7, 2024

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.

 avatar commented on June 7, 2024

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)

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.