Skip to content

Commit 5f8bc75

Browse files
.
1 parent 80e8fee commit 5f8bc75

File tree

3 files changed

+77
-1
lines changed

3 files changed

+77
-1
lines changed

README.md

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,80 @@ Source code of this project is available under the standard MIT license. Please
1919

2020
### Bar Graph
2121

22-
### Line Graph
22+
![Build Platform](images/bar-graph.png)
23+
24+
https://github.com/michalkonturek/GraphKit/blob/master/LICENSE
25+
26+
Initialize `GKBarGraph` from nib or programmatically:
27+
28+
```
29+
CGRect frame = CGRectMake(0, 40, 320, 200);
30+
self.graphView = [[GKBarGraph alloc] initWithFrame:frame];
31+
```
32+
33+
then set `GKGraphViewDataSource`
34+
35+
```
36+
self.graphView.dataSource = self;
37+
```
38+
39+
and call `draw` method.
40+
41+
```
42+
[self.graphView draw];
43+
```
44+
45+
46+
Please see [example][BAR].
47+
48+
[BAR]:https://github.com/michalkonturek/GraphKit/blob/master/GraphKit/Example/ExampleBarGraphVC.m
49+
50+
51+
#### `GKBarGraphDataSource` Protocol
52+
53+
```
54+
@required
55+
- (NSInteger)numberOfBars;
56+
- (NSNumber *)valueForBarAtIndex:(NSInteger)index;
57+
58+
@optional
59+
- (UIColor *)colorForBarAtIndex:(NSInteger)index;
60+
- (CFTimeInterval)animationDurationForBarAtIndex:(NSInteger)index;
61+
- (NSString *)titleForBarAtIndex:(NSInteger)index;
62+
```
63+
64+
65+
### Line Graph
66+
67+
![Build Platform](images/line-graph.png)
68+
69+
```
70+
CGRect frame = CGRectMake(0, 40, 320, 200);
71+
self.graphView = [[GKLineGraph alloc] initWithFrame:frame];
72+
73+
self.graph.dataSource = <<data-source>>;
74+
self.graph.lineWidth = 3.0;
75+
76+
[self.graph draw];
77+
```
78+
79+
Please see [example][LINE].
80+
81+
[LINE]:https://github.com/michalkonturek/GraphKit/blob/master/GraphKit/Example/ExampleLineGraph.m
82+
83+
84+
#### `GKLineGraphDataSource` Protocol
85+
86+
```
87+
@required
88+
- (NSInteger)numberOfLines;
89+
- (UIColor *)colorForLineAtIndex:(NSInteger)index;
90+
- (NSArray *)valuesForLineAtIndex:(NSInteger)index;
91+
92+
@optional
93+
- (CFTimeInterval)animationDurationForLineAtIndex:(NSInteger)index;
94+
- (NSString *)titleForLineAtIndex:(NSInteger)index;
95+
```
96+
97+
[@MichalKonturek](https://twitter.com/MichalKonturek)
98+

images/bar-graph.png

31.2 KB
Loading

images/line-graph.png

198 KB
Loading

0 commit comments

Comments
 (0)