Skip to content

Commit c7aa776

Browse files
Merge branch 'release/1.0.0'
2 parents 0d67383 + d014e3f commit c7aa776

File tree

109 files changed

+7251
-277
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+7251
-277
lines changed

GraphKit.podspec

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
Pod::Spec.new do |s|
33
s.name = "GraphKit"
4-
s.version = "0.1.0"
5-
s.summary = "iOS kit for creating simple types of graphs / charts."
4+
s.version = "1.0.0"
5+
s.summary = "A lightweight library of animated charts for iOS."
66
s.homepage = "https://github.com/michalkonturek/GraphKit"
77
s.license = 'MIT'
88

@@ -11,13 +11,16 @@ Pod::Spec.new do |s|
1111
}
1212

1313
s.ios.deployment_target = '7.0'
14-
14+
15+
s.social_media_url = 'https://twitter.com/michalkonturek'
1516
s.source = {
1617
:git => "https://github.com/michalkonturek/GraphKit.git",
17-
:tag => "0.1.0"
18+
:tag => "1.0.0"
1819
}
1920

2021
s.source_files = 'Source/**/*.{h,m}'
2122
s.requires_arc = true
2223

24+
s.dependency 'FrameAccessor', '~> 1.3.2'
25+
s.dependency 'MKFoundationKit/NSArray', '~> 1.2.2'
2326
end

GraphKit/Example/BarGraphViewVC.h

Lines changed: 0 additions & 17 deletions
This file was deleted.

GraphKit/Example/BarGraphViewVC.m

Lines changed: 0 additions & 30 deletions
This file was deleted.

GraphKit/Example/ExampleBarGraphVC.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// BarGraphViewVC.h
3+
// GraphKit
4+
//
5+
// Created by Michal Konturek on 17/04/2014.
6+
// Copyright (c) 2014 Michal Konturek. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
#import "GraphKit.h"
12+
13+
@interface ExampleBarGraphVC : UIViewController<GKBarGraphDataSource>
14+
15+
@property (nonatomic, weak) IBOutlet GKBarGraph *graphView;
16+
17+
@property (nonatomic, strong) NSArray *data;
18+
@property (nonatomic, strong) NSArray *labels;
19+
20+
- (IBAction)onButtonFill:(id)sender;
21+
22+
- (IBAction)onButtonChange:(id)sender;
23+
24+
- (IBAction)onButtonReset:(id)sender;
25+
26+
@end

GraphKit/Example/ExampleBarGraphVC.m

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
//
2+
// BarGraphViewVC.m
3+
// GraphKit
4+
//
5+
// Created by Michal Konturek on 17/04/2014.
6+
// Copyright (c) 2014 Michal Konturek. All rights reserved.
7+
//
8+
9+
#import "ExampleBarGraphVC.h"
10+
11+
#import "UIViewController+BButton.h"
12+
13+
@interface ExampleBarGraphVC ()
14+
15+
@property (nonatomic, assign) BOOL green;
16+
17+
@end
18+
19+
@implementation ExampleBarGraphVC
20+
21+
- (void)viewDidLoad {
22+
[super viewDidLoad];
23+
self.edgesForExtendedLayout = UIRectEdgeNone;
24+
25+
[self setupButtons];
26+
27+
self.view.backgroundColor = [UIColor gk_cloudsColor];
28+
29+
self.data = @[@65, @10, @40, @90, @50, @75];
30+
self.labels = @[@"US", @"UK", @"DE", @"PL", @"CN", @"JP"];
31+
32+
// self.graphView.barWidth = 22;
33+
// self.graphView.barHeight = 140;
34+
// self.graphView.marginBar = 25;
35+
self.graphView.dataSource = self;
36+
37+
[self.graphView construct];
38+
self.graphView.animationDuration = 2.0;
39+
[self.graphView draw];
40+
41+
self.green = YES;
42+
}
43+
44+
- (void)didReceiveMemoryWarning {
45+
[super didReceiveMemoryWarning];
46+
}
47+
48+
- (IBAction)onButtonFill:(id)sender {
49+
[self.graphView draw];
50+
}
51+
52+
- (IBAction)onButtonChange:(id)sender {
53+
self.green = !self.green;
54+
self.graphView.barColor = (self.green) ? [UIColor gk_turquoiseColor] : [UIColor gk_amethystColor];
55+
}
56+
57+
- (IBAction)onButtonReset:(id)sender {
58+
[self.graphView reset];
59+
}
60+
61+
62+
#pragma mark - GKBarGraphDataSource
63+
64+
- (NSInteger)numberOfBars {
65+
return [self.data count];
66+
}
67+
68+
- (NSNumber *)valueForBarAtIndex:(NSInteger)index {
69+
return [self.data objectAtIndex:index];
70+
}
71+
72+
- (UIColor *)colorForBarAtIndex:(NSInteger)index {
73+
id colors = @[[UIColor gk_turquoiseColor],
74+
[UIColor gk_peterRiverColor],
75+
[UIColor gk_alizarinColor],
76+
[UIColor gk_amethystColor],
77+
[UIColor gk_emerlandColor],
78+
[UIColor gk_sunflowerColor]
79+
];
80+
return [colors objectAtIndex:index];
81+
}
82+
83+
- (CFTimeInterval)animationDurationForBarAtIndex:(NSInteger)index {
84+
CGFloat percentage = [[self valueForBarAtIndex:index] doubleValue];
85+
percentage = (percentage / 100);
86+
return (self.graphView.animationDuration * percentage);
87+
}
88+
89+
- (NSString *)titleForBarAtIndex:(NSInteger)index {
90+
return [self.labels objectAtIndex:index];
91+
}
92+
93+
@end
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="5056" systemVersion="13C64" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
5+
</dependencies>
6+
<objects>
7+
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ExampleBarGraphVC">
8+
<connections>
9+
<outlet property="graphView" destination="gjl-GW-jRD" id="6H5-80-0EV"/>
10+
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
11+
</connections>
12+
</placeholder>
13+
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
14+
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
15+
<rect key="frame" x="0.0" y="64" width="320" height="504"/>
16+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
17+
<subviews>
18+
<view contentMode="scaleToFill" id="gjl-GW-jRD" customClass="GKBarGraph">
19+
<rect key="frame" x="0.0" y="40" width="320" height="200"/>
20+
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
21+
</view>
22+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="iEG-s3-iYs" customClass="BButton">
23+
<rect key="frame" x="32" y="257" width="80" height="30"/>
24+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
25+
<state key="normal" title="Fill">
26+
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
27+
</state>
28+
<connections>
29+
<action selector="onButtonFill:" destination="-1" eventType="touchUpInside" id="Tpz-Hr-4Uy"/>
30+
</connections>
31+
</button>
32+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="Oc1-Oo-XsA" customClass="BButton">
33+
<rect key="frame" x="120" y="257" width="80" height="30"/>
34+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
35+
<state key="normal" title="Reset">
36+
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
37+
</state>
38+
<connections>
39+
<action selector="onButtonReset:" destination="-1" eventType="touchUpInside" id="E3n-ge-Qgo"/>
40+
</connections>
41+
</button>
42+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="pth-bB-990" customClass="BButton">
43+
<rect key="frame" x="208" y="257" width="80" height="30"/>
44+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
45+
<state key="normal" title="Color">
46+
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
47+
</state>
48+
<connections>
49+
<action selector="onButtonChange:" destination="-1" eventType="touchUpInside" id="QIr-Eh-3iv"/>
50+
</connections>
51+
</button>
52+
</subviews>
53+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
54+
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/>
55+
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" translucent="NO" prompted="NO"/>
56+
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
57+
</view>
58+
</objects>
59+
</document>

GraphKit/Example/ExampleViewVC.h renamed to GraphKit/Example/ExampleBarVC.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@
1010

1111
@class GKBar;
1212

13-
@interface ExampleViewVC : UIViewController
13+
@interface ExampleBarVC : UIViewController
1414

1515
@property (nonatomic, weak) IBOutlet GKBar *bar;
1616

1717
- (IBAction)onButtonAdd:(id)sender;
18+
1819
- (IBAction)onButtonMinus:(id)sender;
1920

20-
- (IBAction)onButtonClear:(id)sender;
21+
- (IBAction)onButtonChange:(id)sender;
22+
23+
- (IBAction)onButtonReset:(id)sender;
2124

2225
@end

GraphKit/Example/ExampleBarVC.m

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
//
2+
// ExampleViewVC.m
3+
// GraphKit
4+
//
5+
// Created by Michal Konturek on 16/04/2014.
6+
// Copyright (c) 2014 Michal Konturek. All rights reserved.
7+
//
8+
9+
#import "ExampleBarVC.h"
10+
11+
#import "GraphKit.h"
12+
13+
#import "UIViewController+BButton.h"
14+
15+
@interface ExampleBarVC ()
16+
17+
@property (nonatomic, assign) BOOL green;
18+
19+
@end
20+
21+
@implementation ExampleBarVC
22+
23+
- (void)viewDidLoad {
24+
[super viewDidLoad];
25+
self.edgesForExtendedLayout = UIRectEdgeNone;
26+
27+
[self setupButtons];
28+
29+
self.view.backgroundColor = [UIColor gk_cloudsColor];
30+
31+
self.bar.animationDuration = 0.4;
32+
self.bar.percentage = 40;
33+
34+
self.green = YES;
35+
}
36+
37+
- (void)didReceiveMemoryWarning {
38+
[super didReceiveMemoryWarning];
39+
}
40+
41+
- (IBAction)onButtonAdd:(id)sender {
42+
self.bar.animated = YES;
43+
self.bar.percentage += 20;
44+
}
45+
46+
- (IBAction)onButtonMinus:(id)sender {
47+
self.bar.percentage -= 20;
48+
}
49+
50+
- (IBAction)onButtonChange:(id)sender {
51+
self.green = !self.green;
52+
self.bar.foregroundColor = (self.green) ? [UIColor gk_turquoiseColor] : [UIColor gk_amethystColor];;
53+
}
54+
55+
- (IBAction)onButtonReset:(id)sender {
56+
[self.bar reset];
57+
}
58+
59+
@end

0 commit comments

Comments
 (0)