var lineChart = LineChart()
lineChart.addLine([3, 4, 9, 11, 13, 15])
- Super simple
- Highly customizable
- Auto scaling
- Touch enabled
- Two-colored area between line charts
gridVisible
Show or hide grid. Defaulttrue
.axesVisible
Show or hide x and y axes. Defaulttrue
.dotsVisible
Show tiny dots at data points. Defaulttrue
.labelsXVisible
Show labels on x axis. Defaultfalse
.labelsYVisible
Show labels on y axis. Defaultfalse
.numberOfGridLinesX
Number of grid lines in horizontal direction. Default10
.numberOfGridLinesY
Number of grid lines in vertical direction. Default10
.animationEnabled
Draw line and dots with animation. Defaulttrue
.animationDuration
Animation duration. Default1
.dotsBackgroundColor
Tiny dots background color. Default white.gridColor
Grid color. Default light grey.axesColor
Axes color. Default grey.positiveAreaColor
Filled area color when line A > line B. Default light green.negativeAreaColor
Filled area color when line A < line B. Default light red.areaBetweenLines
Draw filled area between lines with those two indexes. Default[-1, -1]
lineWidth
Line width. Default2
.dotsSize
Dot size. Default12
.dotsBorderWidth
Dot border width. Default4
.axisInset
Padding between view border and chart axes. Default10
.
Add line to chart.
lineChart.addLine(data: Array<CGFloat>)
didSelectDataPoint()
Touch event happened at or close to data point.
func didSelectDataPoint(x: CGFloat, yValues: Array<CGFloat>) {
println("\(x) and \(yValues)")
}
var lineChart = LineChart()
lineChart.addLine([3, 4, 9, 11, 13, 15])
var lineChart = LineChart()
lineChart.gridVisible = false
lineChart.dotsVisible = false
lineChart.addLine([3, 4, 9, 11, 13, 15])
lineChart.addLine([5, 4, 3, 6, 6, 7])
var lineChart = LineChart()
lineChart.dotsVisible = false
lineChart.addLine([3, 4, 9, 11, 13, 15])
lineChart.addLine([5, 4, 3, 6, 6, 7])
lineChart.areaBetweenLines = [0, 1]
var lineChart = LineChart()
lineChart.addLine([3, 4, 9, 11, 13, 15])
lineChart.addLine([5, 4, 3, 6, 6, 7])
lineChart.axisInset = 20
lineChart.labelsXVisible = true
lineChart.numberOfGridLinesX = 5
lineChart.labelsYVisible = true
lineChart.numberOfGridLinesY = 5
MIT