1- # Scrolling GraphView
1+ # ScrollableGraphView
22
33## About
44
@@ -41,19 +41,27 @@ An adaptive scrollable graph view for iOS to visualise simple discrete datasets.
4141
4242## Usage
4343
44- ### Adding the GraphView to your project:
44+ ### Adding the ScrollableGraphView to your project:
4545
46- 1 . Add [ GraphView.swift ] ( graphview_example/GraphView/GraphView.swift ) to your project in Xcode
46+ Add the ``` ScrollableGraphView ``` class to your project. There are two ways to add the ScrollableGraphView to your project.
4747
48- 2 . Create a GraphView instance and set the data and labels
48+ #### Manually
49+ Add [ ScrollableGraphView.swift] ( graphview_example/ScrollableGraphView/ScrollableGraphView.swift ) to your project in Xcode
50+
51+ #### CocoaPods
52+ Add ``` pod 'ScrollableGraphView' ``` to your Podfile and then make sure to ``` import ScrollableGraphView ``` in your code.
53+
54+ ### Creating a graph and setting the data.
55+
56+ 1 . Create a ScrollableGraphView instance and set the data and labels
4957 ``` swift
50- let graphView = GraphView (frame : someFrame)
58+ let graphView = ScrollableGraphView (frame : someFrame)
5159 let data = [4 , 8 , 15 , 16 , 23 , 42 ]
5260 let labels = [" one" , " two" , " three" , " four" , " five" , " six" ]
5361 graphView.setData (data, withLabels : labels)
5462 ```
5563
56- 3 . Add the GraphView to the view hierarchy.
64+ 2 . Add the ScrollableGraphView to the view hierarchy.
5765 ```swift
5866 someViewController.view .addSubview (graphView)
5967 ```
@@ -79,28 +87,28 @@ _Note: Examples here use a "colorFromHex" extension for UIColor._
7987### Default
8088! [dark](readme_images/ gallery/ default .png )
8189```swift
82- let graphView = GraphView (frame : frame)
90+ let graphView = ScrollableGraphView (frame : frame)
8391graphView.setData (data, withLabels : labels)
8492self .view .addSubview (graphView)
8593```
8694
8795### Smooth Dark
8896! [dark](readme_images/ gallery/ dark.png )
8997```swift
90- let graphView = GraphView (frame : frame)
98+ let graphView = ScrollableGraphView (frame : frame)
9199
92100graphView.backgroundFillColor = UIColor.colorFromHex (" #333333" )
93101
94102graphView.rangeMax = 50
95103
96104graphView.lineWidth = 1
97105graphView.lineColor = UIColor.colorFromHex (" #777777" )
98- graphView.lineStyle = GraphViewLineStyle .Smooth
106+ graphView.lineStyle = ScrollableGraphViewLineStyle .Smooth
99107
100108graphView.shouldFill = true
101- graphView.fillType = GraphViewFillType .Gradient
109+ graphView.fillType = ScrollableGraphViewFillType .Gradient
102110graphView.fillColor = UIColor.colorFromHex (" #555555" )
103- graphView.fillGradientType = GraphViewGradientType .Linear
111+ graphView.fillGradientType = ScrollableGraphViewGradientType .Linear
104112graphView.fillGradientStartColor = UIColor.colorFromHex (" #555555" )
105113graphView.fillGradientEndColor = UIColor.colorFromHex (" #444444" )
106114
@@ -120,7 +128,7 @@ self.view.addSubview(graphView)
120128### Dot
121129! [dot](readme_images/ gallery/ dot.png )
122130```swift
123- let graphView = GraphView (frame :frame)
131+ let graphView = ScrollableGraphView (frame :frame)
124132graphView.backgroundFillColor = UIColor.colorFromHex (" #00BFFF" )
125133graphView.lineColor = UIColor.clearColor ()
126134
@@ -133,7 +141,7 @@ graphView.dataPointFillColor = UIColor.whiteColor()
133141graphView.referenceLineLabelFont = UIFont.boldSystemFontOfSize (10 )
134142graphView.referenceLineColor = UIColor.whiteColor ().colorWithAlphaComponent (0.5 )
135143graphView.referenceLineLabelColor = UIColor.whiteColor ()
136- graphView.referenceLinePosition = GraphViewReferenceLinePosition .Both
144+ graphView.referenceLinePosition = ScrollableGraphViewReferenceLinePosition .Both
137145
138146graphView.numberOfIntermediateReferenceLines = 9
139147
@@ -145,7 +153,7 @@ self.view.addSubview(graphView)
145153### Pink Mountain
146154! [pink](readme_images/ gallery/ pink_mountain.png )
147155```swift
148- let graphView = GraphView (frame :frame)
156+ let graphView = ScrollableGraphView (frame :frame)
149157graphView.backgroundFillColor = UIColor.colorFromHex (" #222222" )
150158graphView.lineColor = UIColor.clearColor ()
151159
@@ -161,7 +169,7 @@ graphView.referenceLineThickness = 1
161169graphView.referenceLineLabelFont = UIFont.boldSystemFontOfSize (10 )
162170graphView.referenceLineColor = UIColor.whiteColor ().colorWithAlphaComponent (0.5 )
163171graphView.referenceLineLabelColor = UIColor.whiteColor ()
164- graphView.referenceLinePosition = GraphViewReferenceLinePosition .Both
172+ graphView.referenceLinePosition = ScrollableGraphViewReferenceLinePosition .Both
165173
166174graphView.numberOfIntermediateReferenceLines = 1
167175
@@ -175,14 +183,14 @@ You can use the top and bottom margin to leave space for other content:
175183
176184! [pink_margins](readme_images/ gallery/ pink_margins.png )
177185```swift
178- let graphView = GraphView (frame :frame)
186+ let graphView = ScrollableGraphView (frame :frame)
179187
180188graphView.bottomMargin = 350
181189graphView.topMargin = 20
182190
183191graphView.backgroundFillColor = UIColor.colorFromHex (" #222222" )
184192graphView.lineColor = UIColor.clearColor ()
185- graphView.lineStyle = GraphViewLineStyle .Smooth
193+ graphView.lineStyle = ScrollableGraphViewLineStyle .Smooth
186194
187195graphView.shouldFill = true
188196graphView.fillColor = UIColor.colorFromHex (" #FF0080" )
@@ -206,7 +214,7 @@ self.view.addSubview(graphView)
206214
207215## Customisation
208216
209- The graph can be customised by setting any of the following public properties before displaying the GraphView . The defaults are shown below.
217+ The graph can be customised by setting any of the following public properties before displaying the ScrollableGraphView . The defaults are shown below.
210218
211219### Line Styles
212220
@@ -221,14 +229,14 @@ var lineColor = UIColor.blackColor()
221229The color of the graph line. UIColor.
222230
223231```swift
224- var lineStyle = GraphViewLineStyle .Straight
232+ var lineStyle = ScrollableGraphViewLineStyle .Straight
225233```
226234Whether or not the line should be rendered using bezier curves are straight lines.
227235
228236Possible values:
229237
230- - ```GraphViewLineStyle .Straight```
231- - ```GraphViewLineStyle .Smooth```
238+ - ```ScrollableGraphViewLineStyle .Straight```
239+ - ```ScrollableGraphViewLineStyle .Smooth```
232240
233241```swift
234242var lineJoin = kCALineJoinRound
@@ -252,14 +260,14 @@ var shouldFill = false
252260Specifies whether or not the plotted graph should be filled with a colour or gradient.
253261
254262```swift
255- var fillType = GraphViewFillType .Solid
263+ var fillType = ScrollableGraphViewFillType .Solid
256264```
257265Specifies whether to fill the graph with a solid colour or gradient.
258266
259267Possible values:
260268
261- - ```GraphViewFillType .Solid```
262- - ```GraphViewFillType .Gradient```
269+ - ```ScrollableGraphViewFillType .Solid```
270+ - ```ScrollableGraphViewFillType .Gradient```
263271
264272```swift
265273var fillColor = UIColor.blackColor ()
@@ -277,14 +285,14 @@ var fillGradientEndColor = UIColor.blackColor()
277285If ```fillType``` is set to ```.Gradient```, then this will be the ending colour for the gradient.
278286
279287```swift
280- var fillGradientType = GraphViewGradientType .Linear
288+ var fillGradientType = ScrollableGraphViewGradientType .Linear
281289```
282290If ```fillType``` is set to ```.Gradient```, then this defines whether the gradient is rendered as a linear gradient or radial gradient.
283291
284292Possible values:
285293
286- - ```GraphViewFillType .Solid```
287- - ```GraphViewFillType .Gradient```
294+ - ```ScrollableGraphViewFillType .Solid```
295+ - ```ScrollableGraphViewFillType .Gradient```
288296
289297### Spacing
290298
@@ -316,14 +324,14 @@ var dataPointSpacing: CGFloat = 40
316324How much space should be between each data point.
317325
318326```swift
319- var direction = GraphViewDirection .LeftToRight
327+ var direction = ScrollableGraphViewDirection .LeftToRight
320328```
321329Which way the user is expected to scroll from.
322330
323331Possible values:
324332
325- - ```GraphViewDirection .LeftToRight```
326- - ```GraphViewDirection .RightToLeft```
333+ - ```ScrollableGraphViewDirection .LeftToRight```
334+ - ```ScrollableGraphViewDirection .RightToLeft```
327335
328336
329337### Graph Range
@@ -355,15 +363,15 @@ var shouldDrawDataPoint = true
355363Whether or not to draw a symbol for each data point.
356364
357365```swift
358- var dataPointType = GraphViewDataPointType .Circle
366+ var dataPointType = ScrollableGraphViewDataPointType .Circle
359367```
360368The shape to draw for each data point.
361369
362370Possible values:
363371
364- - ```GraphViewDataPointType .Circle```
365- - ```GraphViewDataPointType .Square```
366- - ```GraphViewDataPointType .Custom```
372+ - ```ScrollableGraphViewDataPointType .Circle```
373+ - ```ScrollableGraphViewDataPointType .Square```
374+ - ```ScrollableGraphViewDataPointType .Custom```
367375
368376```swift
369377var dataPointSize: CGFloat = 5
@@ -399,15 +407,15 @@ var animationDuration = 1
399407How long the animation should take. Affects both the startup animation and the animation when the range of the y- axis adapts to onscreen points.
400408
401409```swift
402- var adaptAnimationType = GraphViewAnimationType .EaseOut
410+ var adaptAnimationType = ScrollableGraphViewAnimationType .EaseOut
403411```
404412The animation style.
405413
406414Possible values:
407415
408- - ```GraphViewAnimationType .EaseOut```
409- - ```GraphViewAnimationType .Elastic```
410- - ```GraphViewAnimationType .Custom```
416+ - ```ScrollableGraphViewAnimationType .EaseOut```
417+ - ```ScrollableGraphViewAnimationType .Elastic```
418+ - ```ScrollableGraphViewAnimationType .Custom```
411419
412420```swift
413421var customAnimationEasingFunction: ((t : Double ) -> Double )?
@@ -436,18 +444,18 @@ var referenceLineThickness: CGFloat = 0.5
436444The thickness of the reference lines.
437445
438446```swift
439- var referenceLinePosition = GraphViewReferenceLinePosition .Left
447+ var referenceLinePosition = ScrollableGraphViewReferenceLinePosition .Left
440448```
441449Where the labels should be displayed on the reference lines.
442450
443451Possible values:
444452
445- - ```GraphViewReferenceLinePosition .Left```
446- - ```GraphViewReferenceLinePosition .Right```
447- - ```GraphViewReferenceLinePosition .Both```
453+ - ```ScrollableGraphViewReferenceLinePosition .Left```
454+ - ```ScrollableGraphViewReferenceLinePosition .Right```
455+ - ```ScrollableGraphViewReferenceLinePosition .Both```
448456
449457```swift
450- var referenceLineType = GraphViewReferenceLineType .Cover
458+ var referenceLineType = ScrollableGraphViewReferenceLineType .Cover
451459```
452460The type of reference lines. Currently only ```.Cover``` is available.
453461
0 commit comments