Showing
6 changed files
with
152 additions
and
54 deletions
| @@ -30,6 +30,7 @@ | @@ -30,6 +30,7 @@ | ||
| 30 | 0AF7A8BF182AEB99003645C4 /* PNColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AF7A8BD182AEB99003645C4 /* PNColor.m */; }; | 30 | 0AF7A8BF182AEB99003645C4 /* PNColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AF7A8BD182AEB99003645C4 /* PNColor.m */; }; |
| 31 | 9F55483E18498E0E004073B5 /* PNCircleChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F55483D18498E0E004073B5 /* PNCircleChart.m */; }; | 31 | 9F55483E18498E0E004073B5 /* PNCircleChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F55483D18498E0E004073B5 /* PNCircleChart.m */; }; |
| 32 | 9F656B51184A4E34002E5675 /* UICountingLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F656B50184A4E34002E5675 /* UICountingLabel.m */; }; | 32 | 9F656B51184A4E34002E5675 /* UICountingLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F656B50184A4E34002E5675 /* UICountingLabel.m */; }; |
| 33 | + 9FA23B10184A5944002DBBA4 /* PCChartsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FA23B0F184A5944002DBBA4 /* PCChartsTableViewController.m */; }; | ||
| 33 | /* End PBXBuildFile section */ | 34 | /* End PBXBuildFile section */ |
| 34 | 35 | ||
| 35 | /* Begin PBXContainerItemProxy section */ | 36 | /* Begin PBXContainerItemProxy section */ |
| @@ -79,6 +80,8 @@ | @@ -79,6 +80,8 @@ | ||
| 79 | 9F55483D18498E0E004073B5 /* PNCircleChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PNCircleChart.m; path = PNChart/PNCircleChart.m; sourceTree = "<group>"; }; | 80 | 9F55483D18498E0E004073B5 /* PNCircleChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PNCircleChart.m; path = PNChart/PNCircleChart.m; sourceTree = "<group>"; }; |
| 80 | 9F656B4F184A4E34002E5675 /* UICountingLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UICountingLabel.h; path = PNChart/ThirdPart/UICountingLabel.h; sourceTree = "<group>"; }; | 81 | 9F656B4F184A4E34002E5675 /* UICountingLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UICountingLabel.h; path = PNChart/ThirdPart/UICountingLabel.h; sourceTree = "<group>"; }; |
| 81 | 9F656B50184A4E34002E5675 /* UICountingLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UICountingLabel.m; path = PNChart/ThirdPart/UICountingLabel.m; sourceTree = "<group>"; }; | 82 | 9F656B50184A4E34002E5675 /* UICountingLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UICountingLabel.m; path = PNChart/ThirdPart/UICountingLabel.m; sourceTree = "<group>"; }; |
| 83 | + 9FA23B0E184A5944002DBBA4 /* PCChartsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PCChartsTableViewController.h; sourceTree = "<group>"; }; | ||
| 84 | + 9FA23B0F184A5944002DBBA4 /* PCChartsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PCChartsTableViewController.m; sourceTree = "<group>"; }; | ||
| 82 | /* End PBXFileReference section */ | 85 | /* End PBXFileReference section */ |
| 83 | 86 | ||
| 84 | /* Begin PBXFrameworksBuildPhase section */ | 87 | /* Begin PBXFrameworksBuildPhase section */ |
| @@ -198,6 +201,8 @@ | @@ -198,6 +201,8 @@ | ||
| 198 | children = ( | 201 | children = ( |
| 199 | 0AF7A8AD182AAEEF003645C4 /* PCChartViewController.h */, | 202 | 0AF7A8AD182AAEEF003645C4 /* PCChartViewController.h */, |
| 200 | 0AF7A8AE182AAEEF003645C4 /* PCChartViewController.m */, | 203 | 0AF7A8AE182AAEEF003645C4 /* PCChartViewController.m */, |
| 204 | + 9FA23B0E184A5944002DBBA4 /* PCChartsTableViewController.h */, | ||
| 205 | + 9FA23B0F184A5944002DBBA4 /* PCChartsTableViewController.m */, | ||
| 201 | ); | 206 | ); |
| 202 | name = PCChartViewController; | 207 | name = PCChartViewController; |
| 203 | sourceTree = "<group>"; | 208 | sourceTree = "<group>"; |
| @@ -345,6 +350,7 @@ | @@ -345,6 +350,7 @@ | ||
| 345 | 0AF7A8AF182AAEEF003645C4 /* PCChartViewController.m in Sources */, | 350 | 0AF7A8AF182AAEEF003645C4 /* PCChartViewController.m in Sources */, |
| 346 | 9F656B51184A4E34002E5675 /* UICountingLabel.m in Sources */, | 351 | 9F656B51184A4E34002E5675 /* UICountingLabel.m in Sources */, |
| 347 | 0AF7A8BF182AEB99003645C4 /* PNColor.m in Sources */, | 352 | 0AF7A8BF182AEB99003645C4 /* PNColor.m in Sources */, |
| 353 | + 9FA23B10184A5944002DBBA4 /* PCChartsTableViewController.m in Sources */, | ||
| 348 | 0AF7A8BE182AEB99003645C4 /* PNChartLabel.m in Sources */, | 354 | 0AF7A8BE182AEB99003645C4 /* PNChartLabel.m in Sources */, |
| 349 | 0AF7A8B9182AEB80003645C4 /* PNBar.m in Sources */, | 355 | 0AF7A8B9182AEB80003645C4 /* PNBar.m in Sources */, |
| 350 | 0AF7A8A1182AAAAA003645C4 /* PNChart.m in Sources */, | 356 | 0AF7A8A1182AAAAA003645C4 /* PNChart.m in Sources */, |
This diff is collapsed. Click to expand it.
| @@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | #import "PCChartViewController.h" | 9 | #import "PCChartViewController.h" |
| 10 | -#import "PNChart.h" | 10 | + |
| 11 | 11 | ||
| 12 | @interface PCChartViewController () | 12 | @interface PCChartViewController () |
| 13 | 13 | ||
| @@ -19,61 +19,14 @@ | @@ -19,61 +19,14 @@ | ||
| 19 | { | 19 | { |
| 20 | [super viewDidLoad]; | 20 | [super viewDidLoad]; |
| 21 | 21 | ||
| 22 | - //Add LineChart | ||
| 23 | - UILabel * lineChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 30, SCREEN_WIDTH, 30)]; | ||
| 24 | - lineChartLabel.text = @"Line Chart"; | ||
| 25 | - lineChartLabel.textColor = PNFreshGreen; | ||
| 26 | - lineChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0]; | ||
| 27 | - lineChartLabel.textAlignment = NSTextAlignmentCenter; | ||
| 28 | - | ||
| 29 | - PNChart * lineChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 75.0, SCREEN_WIDTH, 200.0)]; | ||
| 30 | - lineChart.backgroundColor = [UIColor clearColor]; | ||
| 31 | - [lineChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]]; | ||
| 32 | - [lineChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]]; | ||
| 33 | - [lineChart strokeChart]; | ||
| 34 | - [self.chartScrollView addSubview:lineChartLabel]; | ||
| 35 | - [self.chartScrollView addSubview:lineChart]; | ||
| 36 | - | ||
| 37 | - //Add BarChart | ||
| 38 | - | ||
| 39 | - UILabel * barChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 300, SCREEN_WIDTH, 30)]; | ||
| 40 | - barChartLabel.text = @"Bar Chart"; | ||
| 41 | - barChartLabel.textColor = PNFreshGreen; | ||
| 42 | - barChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0]; | ||
| 43 | - barChartLabel.textAlignment = NSTextAlignmentCenter; | ||
| 44 | - | ||
| 45 | - PNChart * barChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 335.0, SCREEN_WIDTH, 200.0)]; | ||
| 46 | - barChart.backgroundColor = [UIColor clearColor]; | ||
| 47 | - barChart.type = PNBarType; | ||
| 48 | - [barChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]]; | ||
| 49 | - [barChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]]; | ||
| 50 | - [barChart strokeChart]; | ||
| 51 | - [self.chartScrollView addSubview:barChartLabel]; | ||
| 52 | - [self.chartScrollView addSubview:barChart]; | ||
| 53 | - | ||
| 54 | - //Add CircleChart | ||
| 55 | - | ||
| 56 | - | ||
| 57 | - UILabel * circleChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 550, SCREEN_WIDTH, 30)]; | ||
| 58 | - circleChartLabel.text = @"Circle Chart"; | ||
| 59 | - circleChartLabel.textColor = PNFreshGreen; | ||
| 60 | - circleChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0]; | ||
| 61 | - circleChartLabel.textAlignment = NSTextAlignmentCenter; | ||
| 62 | - | ||
| 63 | - PNChart * circleChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 585.0, SCREEN_WIDTH, 200.0)]; | ||
| 64 | - circleChart.backgroundColor = [UIColor clearColor]; | ||
| 65 | - circleChart.type = PNCircleType; | ||
| 66 | - circleChart.total = [NSNumber numberWithInt:100]; | ||
| 67 | - circleChart.current = [NSNumber numberWithInt:60]; | ||
| 68 | - [circleChart strokeChart]; | ||
| 69 | - [self.chartScrollView addSubview:circleChartLabel]; | ||
| 70 | - [self.chartScrollView addSubview:circleChart]; | ||
| 71 | - | ||
| 72 | - [self.chartScrollView setContentSize:CGSizeMake(SCREEN_WIDTH, 900.0)]; | ||
| 73 | - | ||
| 74 | // Do any additional setup after loading the view. | 22 | // Do any additional setup after loading the view. |
| 75 | } | 23 | } |
| 76 | 24 | ||
| 25 | +- (void)viewWillAppear:(BOOL)animated | ||
| 26 | +{ | ||
| 27 | + [super viewWillAppear:animated]; | ||
| 28 | +} | ||
| 29 | + | ||
| 77 | - (void)didReceiveMemoryWarning | 30 | - (void)didReceiveMemoryWarning |
| 78 | { | 31 | { |
| 79 | [super didReceiveMemoryWarning]; | 32 | [super didReceiveMemoryWarning]; |
PNChartDemo/PCChartsTableViewController.h
0 → 100644
PNChartDemo/PCChartsTableViewController.m
0 → 100644
| 1 | +// | ||
| 2 | +// PCChartsTableViewController.m | ||
| 3 | +// PNChartDemo | ||
| 4 | +// | ||
| 5 | +// Created by kevinzhow on 13-12-1. | ||
| 6 | +// Copyright (c) 2013年 kevinzhow. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "PCChartsTableViewController.h" | ||
| 10 | +#import "PNChart.h" | ||
| 11 | + | ||
| 12 | +@interface PCChartsTableViewController () | ||
| 13 | + | ||
| 14 | +@end | ||
| 15 | + | ||
| 16 | +@implementation PCChartsTableViewController | ||
| 17 | + | ||
| 18 | +- (id)initWithStyle:(UITableViewStyle)style | ||
| 19 | +{ | ||
| 20 | + self = [super initWithStyle:style]; | ||
| 21 | + if (self) { | ||
| 22 | + // Custom initialization | ||
| 23 | + } | ||
| 24 | + return self; | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +- (void)viewDidLoad | ||
| 28 | +{ | ||
| 29 | + [super viewDidLoad]; | ||
| 30 | + | ||
| 31 | + // Uncomment the following line to preserve selection between presentations. | ||
| 32 | + // self.clearsSelectionOnViewWillAppear = NO; | ||
| 33 | + | ||
| 34 | + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. | ||
| 35 | + // self.navigationItem.rightBarButtonItem = self.editButtonItem; | ||
| 36 | +} | ||
| 37 | + | ||
| 38 | +- (void)didReceiveMemoryWarning | ||
| 39 | +{ | ||
| 40 | + [super didReceiveMemoryWarning]; | ||
| 41 | + // Dispose of any resources that can be recreated. | ||
| 42 | +} | ||
| 43 | + | ||
| 44 | +// In a story board-based application, you will often want to do a little preparation before navigation | ||
| 45 | +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender | ||
| 46 | +{ | ||
| 47 | + // Get the new view controller using [segue destinationViewController]. | ||
| 48 | + // Pass the selected object to the new view controller. | ||
| 49 | + | ||
| 50 | + UIViewController * viewController = [segue destinationViewController]; | ||
| 51 | + | ||
| 52 | + if ([segue.identifier isEqualToString:@"lineChart"]) { | ||
| 53 | + | ||
| 54 | + //Add LineChart | ||
| 55 | + UILabel * lineChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, SCREEN_WIDTH, 30)]; | ||
| 56 | + lineChartLabel.text = @"Line Chart"; | ||
| 57 | + lineChartLabel.textColor = PNFreshGreen; | ||
| 58 | + lineChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0]; | ||
| 59 | + lineChartLabel.textAlignment = NSTextAlignmentCenter; | ||
| 60 | + | ||
| 61 | + PNChart * lineChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)]; | ||
| 62 | + lineChart.backgroundColor = [UIColor clearColor]; | ||
| 63 | + [lineChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]]; | ||
| 64 | + [lineChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]]; | ||
| 65 | + [lineChart strokeChart]; | ||
| 66 | + | ||
| 67 | + [viewController.view addSubview:lineChartLabel]; | ||
| 68 | + [viewController.view addSubview:lineChart]; | ||
| 69 | + | ||
| 70 | + viewController.title = @"Line Chart"; | ||
| 71 | + | ||
| 72 | + }else if ([segue.identifier isEqualToString:@"barChart"]) | ||
| 73 | + { | ||
| 74 | + //Add BarChart | ||
| 75 | + | ||
| 76 | + UILabel * barChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, SCREEN_WIDTH, 30)]; | ||
| 77 | + barChartLabel.text = @"Bar Chart"; | ||
| 78 | + barChartLabel.textColor = PNFreshGreen; | ||
| 79 | + barChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0]; | ||
| 80 | + barChartLabel.textAlignment = NSTextAlignmentCenter; | ||
| 81 | + | ||
| 82 | + PNChart * barChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)]; | ||
| 83 | + barChart.backgroundColor = [UIColor clearColor]; | ||
| 84 | + barChart.type = PNBarType; | ||
| 85 | + [barChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]]; | ||
| 86 | + [barChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]]; | ||
| 87 | + [barChart strokeChart]; | ||
| 88 | + | ||
| 89 | + [viewController.view addSubview:barChartLabel]; | ||
| 90 | + [viewController.view addSubview:barChart]; | ||
| 91 | + | ||
| 92 | + viewController.title = @"Bar Chart"; | ||
| 93 | + }else if ([segue.identifier isEqualToString:@"circleChart"]) | ||
| 94 | + { | ||
| 95 | + | ||
| 96 | + //Add CircleChart | ||
| 97 | + | ||
| 98 | + | ||
| 99 | + UILabel * circleChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, SCREEN_WIDTH, 30)]; | ||
| 100 | + circleChartLabel.text = @"Circle Chart"; | ||
| 101 | + circleChartLabel.textColor = PNFreshGreen; | ||
| 102 | + circleChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0]; | ||
| 103 | + circleChartLabel.textAlignment = NSTextAlignmentCenter; | ||
| 104 | + | ||
| 105 | + PNChart * circleChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)]; | ||
| 106 | + circleChart.backgroundColor = [UIColor clearColor]; | ||
| 107 | + circleChart.type = PNCircleType; | ||
| 108 | + circleChart.total = [NSNumber numberWithInt:100]; | ||
| 109 | + circleChart.current = [NSNumber numberWithInt:60]; | ||
| 110 | + [circleChart strokeChart]; | ||
| 111 | + | ||
| 112 | + [viewController.view addSubview:circleChartLabel]; | ||
| 113 | + [viewController.view addSubview:circleChart]; | ||
| 114 | + | ||
| 115 | + viewController.title = @"Circle Chart"; | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + | ||
| 119 | + | ||
| 120 | + | ||
| 121 | + | ||
| 122 | + | ||
| 123 | +} | ||
| 124 | + | ||
| 125 | + | ||
| 126 | +@end |
-
Please register or login to post a comment