philackm / scrollablegraphview Goto Github PK
View Code? Open in Web Editor NEWAn adaptive scrollable graph view for iOS to visualise simple discrete datasets. Written in Swift.
License: MIT License
An adaptive scrollable graph view for iOS to visualise simple discrete datasets. Written in Swift.
License: MIT License
I just wanted to say thank you to the developer behind this. This has been the best graph option I have ever come across. It's easy to implement, very attractive, easy for the user to interact with, and highly customizable. I also appreciate that the whole thing is in a single Swift file I can just drop in my project.
Thanks for all your hard work! This is fantastic! :)
I have a graph that shows data from 1 to 5 and i have labels that equal the date the data was submitted. On the left hand side it shows the data numbers but I want to make them strings where 1 = Good Day, 2 = Ok Day, ect. Is that possible?
It should be possible to add tvOS support. You should just have to disable any touch based apis by wrapping them in checking for the tvOS target.
i am using scrollable-graphview... so I think that is very beautiful chart
but i have to show data value... but scrollable graphview only show path...
how can i show data value each bar ... or each line datapoint ?
Hi Guys
I was wondering how to add shadow to the main line that is connecting the dots as I was inspired by a design. I have figure it out. I'm kindly asking the author of the library to expose it, so can be added easily.
the final goal is to get line which will have shadow as the example below created by Sam Thibault in one of his prototypes.
Because this line chart is using CALayer it can have shadow very easy. You just need to find it where exactly is and add the code.
In file ScrollableraphView.swift locate the function shown bellow i.e. "addDrawingLayers" and add the code to add your shadow(of course you can change the values to change the type of the shadow):
bear in mind that I have switched off the property graphView.shouldFill = false because I wanted the shadow to be below the line.
lineLayer?.shadowOffset = CGSize(width: 4,height: 4)
lineLayer?.shadowColor = UIColor.darkGrayColor().CGColor
lineLayer?.shadowRadius = 2.0
lineLayer?.shadowOpacity = 1.0
After adding the code the line chart was like this
And this is how looks like the function after i added the code.
If someone have idea how to create the gradient for the line itself, it would be great.
Cheers.
is it possible to show multiple line in the graph?
Hi all !
is it possible to display the bar layer horizontally and not vertically ?
Thanks !
Weβd love to use this library in our Mac appβit looks fantastic!
Hello, I'm using Scrollable-GraphView of DarkGraph. But I don't know to add the x-axis and y-axis values from my end I have dates in x-axis and float values in Y-axis in different arrays.
How can I give the 2 arrays to X-axis and Y-axis. Thanks!
Hi, I'm trying to use your Lib, but when I add " pod 'ScrollableGraphView' " to my Podfile, the following error occurs.. " Unable to find a specification for 'ScrollableGraphView' ". How can I solve this problem?
Hi,
For iOS and macOS projets it's will be great to make your component Carthage compatible
Take a look at these articles:
On your README.md
add on top and add section for the installation with Carthage.
thank you for your project. i want to change a point color. not all point but a special point. for example, i want change points which are above 30 to red and 30 less than are be white.
how and where can i do it??
is it possible to reduce the number labels shown on the x-axis? When I have to show large number of points , label in the x-axis are overlapping. And I don't want large spacing between those points.
(or stop the line from rendering after the last data point)
Scenario:
With rightmostPointPadding = 0
my last label gets cut off:
If I extend the padding (or the user pulls to the left more) the line drops down to 0 and looks a little odd
Is it possible to do any of these options?
Thanks!
It would be really nice to have some ///
comments before each variable so we know what each one is doing without having to reverse engineer your code π
You have shown in Demo that we can also use it as bar chart . but there are no methods avaliable for bar chart
I am asking this question so we can add dynamically more data the more the users scrolls.
I have my Graph already displayed. If I tap on a button, i'd like to change the strokecolor of the lineLayer. So I added this in the class:
public func changeLineColor(color : UIColor) {
lineLayer?.strokeColor = color.CGColor
}
But if I call it from my view like: myGraph.changeLineColor(myColor) , it will return the error:
fatal error: use of unimplemented initializer 'init(layer:)' for class 'TestGraph.ScrollableGraphViewDrawingLayer'
I can still change the background color by adding this function and it works:
public func changeBackgroundColor(color : UIColor) {
drawingView.backgroundColor = color
}
BUT do you have any idea why I can't change the linecolor ? :/ thanks !!
It would be great to have the option to display the dataPointsLabels (x-axis) under the graph, so it's not in the filled area.
Is there a way to format the label on y axis? Would be great to be able to format the string. It's useful to display currency and other types of data.
How to detect the tap gesture on the label on the x-axis?
Goal is when the graph is displayed, no "circle" on the curve is displayed but if you tap on the label, the corresponding circle will be displayed with the corresponding value somewhere
First of all, great library, I really like it :)
I'm wondering if we could add more flexiblity to shouldAutomaticallyDetectRange = true. Right now, it will resize the graph depending on what is the max-y value and min-y value. I m wondering if we can add some vertical margin in there?
Example: if max-y value is 115, and y-margin is 15, then highest value in graph would be 130 and not 115 like it is now.
I know that I can just find out what is my max y value and then compute the new rangeMax and rangeMin, but I think it would be nice to have it in the library. I can also help with that if need be, it should not be hard by looking at the code :)
Hi people, I wonder , how to put the lines on the x axis.
I want to show more than one lines in the graph. Is it possible to show add two or more lines in the same graph? Please provide a solution.
Scroll feature is awesome. While scroll reach at and should be option of append new data and add new point in graph.
dataPointLabelsSparsity is shown in the documentation as an available property yet is not implemented in the actual library. Would be nice to have it available as it sounds super useful.
Hi,
For first, thanks for this awesome code.
At this time I am facing a problem with labels and my question is if there is a way to add a value on top of the bar, for example I have a bar of month January and at the bottom I want to add "January" label and on top of this bar I want to add "R$ 100,00" as a String, is this possible? If yes, please someone can explain how?
PS: Please label it as Question ;)
Thanks.
Hi,
I have Command failed due to signal: Segmentation fault: 11
when trying to inherit from ScrollableGraphView
:
@IBDesignable
@objc open class ProductivityGraphView: ScrollableGraphView {
}
- While loading conformances for 'ProductivityGraphView' at
Is there a way to scroll to the end of the view after the animation is complete? or even before the animation starts?
Multiple language features will be removed in Swift 3. The deprecated language features must be replaced with the Swift 3 equivalents.
Consider this a feature request rather than a bug. :)
It would be much more convenient to be able to connect directly to the GraphView from Interface Builder. Unfortunately, I have to create a container right now, because when I hook it up in IB, it tries to call the method that is not implemented yet:
required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") }
I'd be cool to also add Cocoapods support. I done this implementation myself last month for my library. Just follow this post and this checklist.
I want "dataPointSpacing" to calculate automatically based on the graph area width (No Scrolling). Is there is any way to achieve that with the current API's?
Hi,
Nice work indeed.
Can we have 2 line scrollable graph?
This will be a nice enhancement!
Thank you very much
George Gerardis
Using autolayout, I set the graphview 8px trailing and leading space to its view container. However the graph line is overflow. Please take a look at the picture: https://gyazo.com/4d0bfee262e9977983c568b8943c6d17
I'm having some trouble wondering how to refactor my projects in a way that fits the modifications made by Swift 3 conversion.
It would be nice to have the posibility to set indivudual colors for each point or bar, and also to group multiple data values for each label
Hello!
First of all I want to thank you about this awesome library! I'm using it in a new project and It's really smooth. I only have one question. Is it posible to automatically scroll to the end of the graph after it appears on the view?
Best regards!
Can you please update it to support Swift 3?
Hi,
First of all thanks for this awesome library!
I've been using it and sometimes the graph gets updated twice (usually with the same data), before the animation of the first calls finishes. And this causes the animation to abort and restart for the 2nd call. Which looks odd.
To test this include the following code in the viewDidLoad
method of the example project:
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(graphView.animationDuration * 0.5 * Double(NSEC_PER_SEC))), dispatch_get_main_queue()){
self.graphView.setData(self.data, withLabels: self.labels)
}
I think possible solutions would be:
It would be really nice to be able to not only create the object in interface builder but to be able to design the object in interface builder as well.
To fix the first problem you need to replace the initWithCoder
function with
required public init?(coder aDecoder: NSCoder) {`
super.init(coder: aDecoder)`
}
Secondly, after // MARK: - ScrollableGraphView
you need to mark the class as "designable" by adding @IBDesignable
. Then for each variable which you wish to expose to interface builder you need to mark the variable with @IBInspectable
. For example:
public var lineWidth: CGFloat = 2
// Will become
@IBInspectable public var lineWidth: CGFloat = 2
Finally you need to implement this function:
public override func prepareForInterfaceBuilder() {
//Setup view
}
Hi guys,
Do you have any idea how to put GraphView in tableViewCell?
I'm getting lots of crash and can't list two or three different graphs in a tableview
Thanks.
I tried setting the delegate but touchesBegan or other touch events don't fire from the ScrollableGraphView - they fire from my normal view just fine.
Hi,
Could you please add an option to plot multiple values on the graph and an option to select a node/value?
Thanks. Love the Graph.
: Error: this application, or a library it uses, has passed an invalid numeric value (NaN, or not-a-number) to CoreGraphics API and this value is being ignored. Please fix this problem.
This line of code is crashing the app.
assert (layer.zeroYPosition > 0);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.