TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Jan 2016 |
SPMSupports SPM | ✗ |
Maintained by WilliamHu.
GSAnalysis is a simple analysis graphic library written in swift. It includes Apple Health like analysis graphic view.
To run the example project, clone the repo, and run pod install
from the Example directory first.
Use it from storyboard Just drag and drop a UIView to storyboard and change the class to "GSxxxView", that's it.
You also can use it as normal UIView
Both way need to provide the dataSources
//Add from storyboard
//In viewDidLayoutSubviews method just incase the layout is correct
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
//Add from storyboard
barChartFromNib.titleLabel.text = "I am from Nib"
barChartFromNib.points = [5,6,7,9]
}
//Add by code
let frame = CGRect(x: barChartFromNib.frame.origin.x, y: barChartFromNib.frame.height + barChartFromNib.frame.origin.y + 50, width: 200, height: 100)
let barChart = GSBarChartView(frame: frame)
barChart.barSpace = 15.0
barChart.barWidth = 50.0
barChart.points = [5,6,7,9]
barChart.barColor1 = UIColor.redColor()
barChart.barColor2 = UIColor.greenColor()
barChart.baseLineColor = UIColor.blueColor()
self.view.addSubview(barChart)
let lineView = GSLineView(frame: CGRect(x: 50,y: 100,width: 300,height: 300))
lineView.points = [4, 2, 6, 4, 5, 8, 3]
lineView.startColor = UIColor(red: 250/255.0, green: 233/255.0, blue: 222/255.0, alpha: 1.0)
lineView.endColor = UIColor(red: 252/255.0, green: 79/255.0, blue: 8/255.0, alpha: 1.0)
self.view.addSubview(lineView)
IOS 8 and later.
GSAnalysis is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "GSAnalysis"
William Hu, [email protected]
GSAnalysis is available under the MIT license. See the LICENSE file for more info.