zemirco/swift-linechart
소개
Swift로 작성된 iOS용 선 그래프 라이브러리입니다.
웹 및 앱 개발What you can do
- Highly customizable
- Area below lines
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalSwift LineChart

Usage
var lineChart = LineChart()
lineChart.addLine([3, 4, 9, 11, 13, 15])
Features
- Super simple
- Highly customizable
- Auto scaling
- Touch enabled
- Area below lines
Properties
Both x and y properties are of type Coordinate.
Each can be customized separately and has its own settings for labels, gridlines and axis.
labels: Labelsgrid: Gridaxis: Axis
Labels can be switched on and off and they can have custom values.
visible: Bool =truevalues: [String] =[]
Grid can also be switched on/off, has a custom color and you can specify how many gridlines
you'd like to show.
visible: Bool =truecount: CGFloat =10color: UIColor =UIColor(red: 238/255.0, green: 238/255.0, blue: 238/255.0, alpha: 1) // #eeeeee
Axis can be switched on/off, has a property to its color and you can specify how much the axis
is inset from the border of your UIView.
visible: Bool =truecolor: UIColor =UIColor(red: 96/255.0, green: 125/255.0, blue: 139/255.0, alpha: 1) // 607d8binset: CGFloat =15
Animations can be customized through the Animation settings.
enabled: Bool =trueduration: CFTimeInterval =1
If you'd like to show extra dots at your data points use the Dots features.
visible: Bool =truecolor: UIColor =UIColor.whiteColor()innerRadius: CGFloat =8outerRadius: CGFloat =12innerRadiusHighlighted: CGFloat =8outerRadiusHighlighted: CGFloat =12
In addition to the above mentioned features you can further customize your chart.
area: Bool =true- Fill the area between line and x axislineWidth: CGFloat =2- Set the line widthcolors: [UIColor] =[...]- Colors for your line charts
Methods
Add line to chart.
lineChart.addLine(data: [CGFloat])
Remove charts, areas and labels but keep axis and grid.
lineChart.clear()
Make whole UIView white again
lineChart.clearAll()
Delegates
didSelectDataPoint()
Touch event happened at or close to data point.
func didSelectDataPoint(x: CGFloat, yValues: [CGFloat]) {
println("\(x) and \(yValues)")
}
Examples
Single line with default settings.

var lineChart = LineChart()
lineChart.addLine([3, 4, 9, 11, 13, 15])
Two lines without grid and dots.

var lineChart = LineChart()
lineChart.area = false
lineChart.x.grid.visible = false
lineChart.x.labels.visible = false
lineChart.y.grid.visible = false
lineChart.y.labels.visible = false
lineChart.dots.visible = false
lineChart.addLine([3, 4, 9, 11, 13, 15])
lineChart.addLine([5, 4, 3, 6, 6, 7])
Show x and y axis

var lineChart = LineChart()
lineChart.area = false
lineChart.x.grid.count = 5
lineChart.y.grid.count = 5
lineChart.addLine([3, 4, 9, 11, 13, 15])
lineChart.addLine([5, 4, 3, 6, 6, 7])
License
MIT
관련 프로젝트 살펴보기
불러오는 중…