Skip to content

Commit 1092f42

Browse files
.
1 parent 00d8081 commit 1092f42

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

GraphKit/Example/ExampleLineGraph.m

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,25 @@ - (void)viewDidLoad {
2525
self.view.backgroundColor = [UIColor gk_cloudsColor];
2626

2727
self.data = @[
28-
// @[@20, @40, @20, @60, @40, @140, @80],
29-
// @[@40, @20, @60, @100, @60, @20, @60],
30-
// @[@80, @60, @40, @160, @100, @40, @110],
31-
// @[@120, @150, @80, @120, @140, @100, @0]
28+
@[@20, @40, @20, @60, @40, @140, @80],
29+
@[@40, @20, @60, @100, @60, @20, @60],
30+
@[@80, @60, @40, @160, @100, @40, @110],
31+
@[@120, @150, @80, @120, @140, @100, @0],
3232
// @[@620, @650, @580, @620, @540, @400, @0]
33-
@[@10, @4, @8, @2, @9, @3, @6],
34-
@[@1, @2, @3, @4, @5, @6, @10]
3533
];
34+
35+
// self.data = @[
36+
// @[@10, @4, @8, @2, @9, @3, @6],
37+
// @[@1, @2, @3, @4, @5, @6, @10]
38+
// ];
39+
3640
self.labels = @[@"2001", @"2002", @"2003", @"2004", @"2005", @"2006", @"2007"];
3741

3842
self.graph.dataSource = self;
3943
self.graph.lineWidth = 3.0;
4044

4145
// self.graph.startFromZero = YES;
42-
self.graph.valueLabelCount = 10;
46+
self.graph.valueLabelCount = 6;
4347

4448
[self.graph draw];
4549
}
@@ -69,7 +73,8 @@ - (NSInteger)numberOfLines {
6973

7074
- (UIColor *)colorForLineAtIndex:(NSInteger)index {
7175
id colors = @[[UIColor gk_turquoiseColor],
72-
[UIColor clearColor],
76+
// [UIColor clearColor],
77+
[UIColor gk_peterRiverColor],
7378
[UIColor gk_alizarinColor],
7479
[UIColor gk_sunflowerColor]
7580
];

GraphKit/Example/ExampleLineGraph.xib

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1717
<subviews>
1818
<view contentMode="scaleToFill" id="4t0-gr-3LL" customClass="GKLineGraph">
19-
<rect key="frame" x="0.0" y="40" width="320" height="320"/>
19+
<rect key="frame" x="0.0" y="40" width="320" height="220"/>
2020
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
21-
<color key="backgroundColor" name="controlHighlightColor" catalog="System" colorSpace="catalog"/>
21+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
2222
</view>
2323
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="muc-bY-Ywz" customClass="BButton">
24-
<rect key="frame" x="76" y="368" width="80" height="30"/>
24+
<rect key="frame" x="76" y="268" width="80" height="30"/>
2525
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
2626
<state key="normal" title="Draw">
2727
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
@@ -31,7 +31,7 @@
3131
</connections>
3232
</button>
3333
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="Bog-3S-GhQ" customClass="BButton">
34-
<rect key="frame" x="164" y="368" width="80" height="30"/>
34+
<rect key="frame" x="164" y="268" width="80" height="30"/>
3535
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
3636
<state key="normal" title="Reset">
3737
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>

Source/LineGraph/GKLineGraph.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ - (void)_init {
6969
self.lineWidth = kDefaultLineWidth;
7070
self.margin = kDefaultMargin;
7171
self.valueLabelCount = kDefaultValueLabelCount;
72-
// self.clipsToBounds = YES;
72+
self.clipsToBounds = YES;
7373
}
7474

7575
- (void)draw {
@@ -166,8 +166,8 @@ - (void)_constructValueLabels {
166166
CGFloat value = [self _minValue] + (idx * [self _stepValueLabelY]);
167167
item.centerY = [self _positionYForLineValue:value];
168168

169-
// item.text = [@(ceil(value)) stringValue];
170-
item.text = [@(value) stringValue];
169+
item.text = [@(ceil(value)) stringValue];
170+
// item.text = [@(value) stringValue];
171171

172172
[items addObject:item];
173173
[self addSubview:item];

0 commit comments

Comments
 (0)