Comments (11)
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.
Same problem here.
from scrollablegraphview.
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.
@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.
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.
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!
Thanks and best regards!
from scrollablegraphview.
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.
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.
Same problem here. This only happens when using ScrollableGraphViewDirection.RightToLeft.
from scrollablegraphview.
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.
Yeah! It's working perfect! ^_^
Thanks @philackm !!!
from scrollablegraphview.
Related Issues (20)
- Bar Chart with individual columns having varying widths?
- unable to set dot on multiple graph HOT 1
- app crashes on func. - setPlotPointPositions(forNewlyActivatedPoints activatedPoints: [Int], withData data: [Double]) when i scroll the graph HOT 4
- Maximum Number of Points on screen
- DotPlot are not clickable HOT 3
- Ease out animation bug
- y-axis dynamic value instead of original value.
- Carthage Compile error
- How to Create a Stacked Bar Chart? HOT 1
- App crashed every time a value is added HOT 3
- App crash on startup
- As I change the min and max the reference lines text doesn't change HOT 1
- Error installing ScrollableGraphView from Cocopod
- pointIndex - current day
- Is there a way to stop the graph trailing to 0 at the beginning and end of a plot? HOT 2
- Crashing if all the values for Y axis are 0
- put a number related to each bar index
- change the color of each column
- Bar Chart customisations
- Points HOT 1
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 scrollablegraphview.