Giter Club home page Giter Club logo

Comments (11)

hdoria avatar hdoria commented on June 20, 2024 1

Just figured it out. You can change the scroll direction:

graphView.direction = ScrollableGraphViewDirection.RightToLeft

RightToLeft will automatically scroll to the end of the graph .

from scrollablegraphview.

hdoria avatar hdoria commented on June 20, 2024

Same problem here.

from scrollablegraphview.

llKoull avatar llKoull commented on June 20, 2024

Hi hdoria!

I tried this line of code but It doesn't work for me ๐Ÿ˜Ÿ

`let graphView = ScrollableGraphView(frame: CGRectMake(0.0, 0.0, self.frame.width, self.frame.height))
graphView.topMargin = 80

    graphView.backgroundFillColor = UIColor.colorFromHex("#333333")

    graphView.lineWidth = 1
    graphView.lineColor = UIColor.colorFromHex("#777777")
    graphView.lineStyle = ScrollableGraphViewLineStyle.Smooth

    graphView.shouldFill = true
    graphView.fillType = ScrollableGraphViewFillType.Gradient
    graphView.fillColor = UIColor.colorFromHex("#555555")
    graphView.fillGradientType = ScrollableGraphViewGradientType.Linear
    graphView.fillGradientStartColor = UIColor.colorFromHex("#555555")
    graphView.fillGradientEndColor = UIColor.colorFromHex("#444444")

    graphView.dataPointSpacing = 80
    graphView.dataPointSize = 2
    graphView.dataPointFillColor = UIColor.whiteColor()

    graphView.referenceLineLabelFont = UIFont.boldSystemFontOfSize(8)
    graphView.referenceLineColor = UIColor.whiteColor().colorWithAlphaComponent(0.2)
    graphView.referenceLineLabelColor = UIColor.whiteColor()
    graphView.dataPointLabelColor = UIColor.whiteColor().colorWithAlphaComponent(0.5)

    graphView.shouldAnimateOnStartup = true
    graphView.shouldAdaptRange = true
    graphView.adaptAnimationType = .Elastic
    graphView.animationDuration = 1.5
    graphView.shouldRangeAlwaysStartAtZero = true

    self.graphView?.direction = .RightToLeft

    graphView.setData(values, withLabels: labels)
    self.graphContainerView.addSubview(graphView)`

from scrollablegraphview.

philackm avatar philackm commented on June 20, 2024

@hdoria Yes! That property can be used to change which end of the graph it starts at.

@llKoull Try changing:

self.graphView?.direction = .RightToLeft

to

self.graphView.direction = .RightToLeft

I don't think you have declared graphView as an optional.

Otherwise I can't see any other major mistakes. Does it not start at the end of the graph even after changing the direction to .RightToLeft? (Note there is no scrolling animation for this property, it will just start at the end of the graph and the user will have to swipe to the left to see the start of the graph.)

from scrollablegraphview.

llKoull avatar llKoull commented on June 20, 2024

Hi @philackm !

I tried to use self.graphView.direction = .RightToLeft but xcode gives me an error and I cant compile. I also tried to declare it as ! and the i can compile but i get

unexpectedly found nil while unwrapping an Optional value

I always have to scroll from left to right no matters which direction i choose :O

Thanks for your help

from scrollablegraphview.

llKoull avatar llKoull commented on June 20, 2024

I finally got this working, It was my fault, I was using self.grapView and i should use graphview instead.

But now i've got another problem, The graph is scrolling, that's nice! ^_^ but the graphic it's not filled with color It seems that only half part of the graphic is filled until i touch It (some lines and the Y-axis values are also hidden. If i touch the graph It fills up with the correct color).

I attach some pictures!

1
2

Thanks and best regards!

from scrollablegraphview.

philackm avatar philackm commented on June 20, 2024

Hmmm. Could you post the code you have to a GitHub gist (https://gist.github.com) and then post the link here? I'd like to try reproduce it and find what's causing the bug.

On Jun 9, 2016, at 7:39 AM, Raรบl Vidal Muiรฑos [email protected] wrote:

I finally got this working, It was my fault, I was using self.grapView and i should use graphview instead.

But now i've got another problem, The graph scroll, that's nice, but the graphic it's not filled with color It seems that only half part of the graphic is filled until i touch It (some lines and the Y-axis values are also hidden. If i touch the graph It fills up with the correct color).

I attach some pictures!

Thanks and best regards!

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

from scrollablegraphview.

llKoull avatar llKoull commented on June 20, 2024

I'm sorry, but i can't post all the code. Anyways, I can tell you what i've done.

I created a UICollectionView with a custom cell called GraphCollectionViewCell. This is the code of the custom cell:

`import UIKit
import ScrollableGraphView

class GraphCollectionViewCell: UICollectionViewCell {

@IBOutlet weak var graphTitle: UILabel!
@IBOutlet weak var graphContainerView: UIView!
var graphView: ScrollableGraphView?

required init(coder aDecoder: NSCoder)
{
    super.init(coder: aDecoder)!
}

func initializeGraph(values: [Double], labels: [String])
{
    let graphView = ScrollableGraphView(frame: CGRectMake(0.0, 0.0, self.frame.width, self.frame.height))
    graphView.topMargin = 80

    graphView.backgroundFillColor = UIColor.colorFromHex("#333333")

    graphView.lineWidth = 1
    graphView.lineColor = UIColor.colorFromHex("#777777")
    graphView.lineStyle = ScrollableGraphViewLineStyle.Smooth

    graphView.shouldFill = true
    graphView.fillType = ScrollableGraphViewFillType.Gradient
    graphView.fillColor = UIColor.colorFromHex("#555555")
    graphView.fillGradientType = ScrollableGraphViewGradientType.Linear
    graphView.fillGradientStartColor = UIColor.colorFromHex("#555555")
    graphView.fillGradientEndColor = UIColor.colorFromHex("#444444")

    graphView.dataPointSpacing = 80
    graphView.dataPointSize = 2
    graphView.dataPointFillColor = UIColor.whiteColor()

    graphView.referenceLineLabelFont = UIFont.boldSystemFontOfSize(8)
    graphView.referenceLineColor = UIColor.whiteColor().colorWithAlphaComponent(0.2)
    graphView.referenceLineLabelColor = UIColor.whiteColor()
    graphView.dataPointLabelColor = UIColor.whiteColor().colorWithAlphaComponent(0.5)

    graphView.shouldAnimateOnStartup = true
    graphView.shouldAdaptRange = true
    graphView.adaptAnimationType = .Elastic
    graphView.animationDuration = 1.5
    graphView.shouldRangeAlwaysStartAtZero = true

    graphView.setData(values, withLabels: labels)
    graphView.direction = .RightToLeft
    self.graphContainerView.addSubview(graphView)
}

// MARK: Setters



// MARK: Getters

}
`

Then I initialize the cell in the main view using the function

func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell

with the following code:

let cell = collectionView.dequeueReusableCellWithReuseIdentifier(identifier, forIndexPath: indexPath) as! GraphCollectionViewCell cell.initializeGraph(stepsArray, labels: labelsArray) return cell

I think that I autolayout can be affecting to the view.

Thanks for your help!

from scrollablegraphview.

hdoria avatar hdoria commented on June 20, 2024

Same problem here. This only happens when using ScrollableGraphViewDirection.RightToLeft.

from scrollablegraphview.

philackm avatar philackm commented on June 20, 2024

Okay I just pushed 1.1.1 to cocoapods.

@hdoria, @llKoull Can you please try that version and let me know if it is any better?

from scrollablegraphview.

llKoull avatar llKoull commented on June 20, 2024

Yeah! It's working perfect! ^_^

Thanks @philackm !!!

from scrollablegraphview.

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.