@@ -24,6 +24,12 @@ - (void)viewDidLoad {
24
24
25
25
self.view .backgroundColor = [UIColor gk_cloudsColor ];
26
26
27
+ [self _setupExampleGraph ];
28
+ // [self _setupTestingGraph];
29
+ }
30
+
31
+ - (void )_setupExampleGraph {
32
+
27
33
self.data = @[
28
34
@[@20 , @40 , @20 , @60 , @40 , @140 , @80 ],
29
35
@[@40 , @20 , @60 , @100 , @60 , @20 , @60 ],
@@ -32,18 +38,35 @@ - (void)viewDidLoad {
32
38
// @[@620, @650, @580, @620, @540, @400, @0]
33
39
];
34
40
35
- // self.data = @[
36
- // @[@10, @4, @8, @2, @9, @3, @6],
37
- // @[@1, @2, @3, @4, @5, @6, @10]
38
- // ];
41
+ self.labels = @[@" 2001" , @" 2002" , @" 2003" , @" 2004" , @" 2005" , @" 2006" , @" 2007" ];
42
+
43
+ self.graph .dataSource = self;
44
+ self.graph .lineWidth = 3.0 ;
45
+
46
+ self.graph .valueLabelCount = 6 ;
47
+
48
+ [self .graph draw ];
49
+ }
50
+
51
+ - (void )_setupTestingGraph {
52
+
53
+ /*
54
+ A custom max and min values can be achieved by adding
55
+ values for another line and setting its color to clear.
56
+ */
57
+
58
+ self.data = @[
59
+ @[@10 , @4 , @8 , @2 , @9 , @3 , @6 ],
60
+ @[@1 , @2 , @3 , @4 , @5 , @6 , @10 ]
61
+ ];
39
62
40
63
self.labels = @[@" 2001" , @" 2002" , @" 2003" , @" 2004" , @" 2005" , @" 2006" , @" 2007" ];
41
64
42
65
self.graph .dataSource = self;
43
66
self.graph .lineWidth = 3.0 ;
44
67
45
68
// self.graph.startFromZero = YES;
46
- self.graph .valueLabelCount = 6 ;
69
+ self.graph .valueLabelCount = 10 ;
47
70
48
71
[self .graph draw ];
49
72
}
@@ -73,7 +96,6 @@ - (NSInteger)numberOfLines {
73
96
74
97
- (UIColor *)colorForLineAtIndex : (NSInteger )index {
75
98
id colors = @[[UIColor gk_turquoiseColor ],
76
- // [UIColor clearColor],
77
99
[UIColor gk_peterRiverColor ],
78
100
[UIColor gk_alizarinColor ],
79
101
[UIColor gk_sunflowerColor ]
0 commit comments