• Stars
    star
    600
  • Rank 72,369 (Top 2 %)
  • Language
    Swift
  • Created almost 10 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Line Chart library for iOS written in Swift

Swift LineChart

line chart demo

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: Labels
  • grid: Grid
  • axis: Axis

Labels can be switched on and off and they can have custom values.

  • visible: Bool = true
  • values: [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 = true
  • count: CGFloat = 10
  • color: 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 = true
  • color: UIColor = UIColor(red: 96/255.0, green: 125/255.0, blue: 139/255.0, alpha: 1) // 607d8b
  • inset: CGFloat = 15

Animations can be customized through the Animation settings.

  • enabled: Bool = true
  • duration: CFTimeInterval = 1

If you'd like to show extra dots at your data points use the Dots features.

  • visible: Bool = true
  • color: UIColor = UIColor.whiteColor()
  • innerRadius: CGFloat = 8
  • outerRadius: CGFloat = 12
  • innerRadiusHighlighted: CGFloat = 8
  • outerRadiusHighlighted: 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 axis
  • lineWidth: CGFloat = 2 - Set the line width
  • colors: [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.

line chart demo

var lineChart = LineChart()
lineChart.addLine([3, 4, 9, 11, 13, 15])

Two lines without grid and dots.

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

chart with 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

More Repositories

1

json2csv

Convert json to csv with column titles
JavaScript
2,701
star
2

nodejs-pdf-docs

Node.js Manual & Documentation (.pdf, .mobi, .epub)
TeX
493
star
3

lockit

Authentication solution for Express
JavaScript
441
star
4

sf-city-lots-json

really big json file representing san francisco's subdivision parcels
145
star
5

flexbox-grid

Grid system using CSS flex properties
CSS
127
star
6

express-upload-progress

File uploading with Express.js and progress bar
JavaScript
118
star
7

nghellostyle

AngularJS seed for Google Closure Compiler
JavaScript
118
star
8

swift-timeago

Relative time / time ago for Swift
Swift
57
star
9

json2csv-stream

Transform stream from json to csv
JavaScript
52
star
10

node-require-s--best-practices

Some best practices / conventions when using Node's `require()`
JavaScript
50
star
11

couchdb

CouchDB client in Go
Go
44
star
12

tu-darmstadt-latex-thesis

LaTeX template for any thesis at the TU Darmstadt
40
star
13

swift-couchbaselite-cheatsheet

Swift CouchbaseLite Cheat Sheet
Objective-C
39
star
14

keycloak

Go library for accessing the Keycloak API
Go
33
star
15

swift-piechart

Piechart library for iOS written in Swift
Swift
31
star
16

ng-form-shake

CSS3 form shake effect with AngularJS
CSS
27
star
17

couchdb-cookie-auth

CouchDB cookie authentication example with PouchDB
JavaScript
25
star
18

ng-signup-form

GitHub like signup form with AngularJS
JavaScript
24
star
19

email

Easily send HTML emails with Golang
Go
19
star
20

mozilla-persona-express-couchdb

Mozilla Persona example app with Express and CouchDB
JavaScript
18
star
21

csrf-express-angular

CSRF protection example app built with Express and Angular
JavaScript
18
star
22

gartner-wcm-d3

Interactive summary of Gartner's Magic Quadrant for Web Content Management with d3.js
JavaScript
17
star
23

swift-couchdb

CouchDB client for Swift
Swift
15
star
24

couch-pwd

CouchDB like salt and password generation with PBKDF2
JavaScript
12
star
25

follow

Go client for CouchDB _changes API
Go
12
star
26

primus-express-session

Share a user session between Express and Primus
JavaScript
11
star
27

uid

URL safe string generator for Go / Golang
Go
10
star
28

simple-recaptcha

simple implementation of google's reCAPTCHA
JavaScript
9
star
29

codedeploy-golang

AWS CodeDeploy Golang app
Shell
9
star
30

d3-hill-chart

d3 hill chart
JavaScript
9
star
31

pouchdb-vs-couchbase

cordova app to compare performance of pouchdb and couchbase lite phonegap
Objective-C
9
star
32

lockit-signup

sign up routes for lockit middleware
JavaScript
9
star
33

lockit-login

login and logout routes for lockit
JavaScript
9
star
34

lockit-couchdb-adapter

CouchDB adapter for lockit
JavaScript
8
star
35

lockit-sendmail

Email utilities for lockit
JavaScript
7
star
36

lockit-mongodb-adapter

MongoDB adapter for lockit
JavaScript
7
star
37

bannerify

Add banner to your browserify bundle
JavaScript
7
star
38

memorystore

memory session store for gorilla/sessions
Go
6
star
39

dok

JavaScript documentation generator based on JSDoc
JavaScript
6
star
40

papertrail

Golang client for papertrail
Go
6
star
41

lockit-utilities

Utilities module for lockit
JavaScript
6
star
42

old-zemirco.github.io

My private blog powered by Octopress
JavaScript
5
star
43

zemirco.github.io

http://mircozeiss.com/ powered by Jekyll
CSS
4
star
44

lockit-delete-account

delete account middleware for lockit
JavaScript
4
star
45

dcp

Discovery and Basic Configuration Protocol (DCP)
Go
4
star
46

enterjs

react d3 showcase
JavaScript
3
star
47

grunt-jade-preprocess

Grunt deployment process with Jade
JavaScript
3
star
48

seriesci-demo

Series CI demo
Shell
3
star
49

lockit-forgot-password

forgot password middleware for lockit
JavaScript
3
star
50

panel.jsx

React Panel component
JavaScript
2
star
51

swift-http

Swift HTTP
Swift
2
star
52

swift-scale

d3.js like scale in Swift
Swift
2
star
53

lockit-template-blank

blank email template for lockit-sendmail
JavaScript
2
star
54

ng-scoreboard-clock

An angular.js directive to display the current time as seen on sports scoreboards.
JavaScript
2
star
55

couchdb-browser-auth

CouchDB user authentication from the browser
JavaScript
2
star
56

codedeploy-couchdb

CodeDeploy CouchDB
Shell
2
star
57

enterjs2019

enterJS 2019 demo app
JavaScript
2
star
58

docker

Dockerfiles
Go
1
star
59

branch

branch demo
1
star
60

enterjs2020

enterJS 2020
TypeScript
1
star
61

couchdb-ssl

CouchDB with nginx
Nginx
1
star
62

jira

JIRA REST API client in Go
Go
1
star
63

protoc-gen-twirp-es

JavaScript code generator for Twirp RPC
Go
1
star
64

sankey

D3 sankey
JavaScript
1
star
65

zemirq

nng test
Go
1
star
66

dotfiles

dotfiles
Vim Script
1
star
67

lockit-sql-adapter

SQL adapter for lockit
JavaScript
1
star
68

lockit-profile

sample '/profile' route for Lockit
JavaScript
1
star
69

swift-querystring

Swift library for encoding classes into URL query parameters
Swift
1
star
70

lockit-koa-login

Lockit login module for Koa
JavaScript
1
star
71

table.jsx

React Table component
JavaScript
1
star
72

string2stream

Converts a string into a stream by emitting one character after the other
JavaScript
1
star