Whitespace and other fixes in demo.
- Clean up some unusual whitespace, or lack thereof. - Remove empty method definitions.
Showing
1 changed file
with
17 additions
and
66 deletions
| @@ -8,38 +8,8 @@ | @@ -8,38 +8,8 @@ | ||
| 8 | 8 | ||
| 9 | #import "PCChartsTableViewController.h" | 9 | #import "PCChartsTableViewController.h" |
| 10 | 10 | ||
| 11 | -@interface PCChartsTableViewController () | ||
| 12 | - | ||
| 13 | -@end | ||
| 14 | - | ||
| 15 | @implementation PCChartsTableViewController | 11 | @implementation PCChartsTableViewController |
| 16 | 12 | ||
| 17 | -- (id)initWithStyle:(UITableViewStyle)style | ||
| 18 | -{ | ||
| 19 | - self = [super initWithStyle:style]; | ||
| 20 | - if (self) { | ||
| 21 | - // Custom initialization | ||
| 22 | - } | ||
| 23 | - return self; | ||
| 24 | -} | ||
| 25 | - | ||
| 26 | -- (void)viewDidLoad | ||
| 27 | -{ | ||
| 28 | - [super viewDidLoad]; | ||
| 29 | - | ||
| 30 | - // Uncomment the following line to preserve selection between presentations. | ||
| 31 | - // self.clearsSelectionOnViewWillAppear = NO; | ||
| 32 | - | ||
| 33 | - // Uncomment the following line to display an Edit button in the navigation bar for this view controller. | ||
| 34 | - // self.navigationItem.rightBarButtonItem = self.editButtonItem; | ||
| 35 | -} | ||
| 36 | - | ||
| 37 | -- (void)didReceiveMemoryWarning | ||
| 38 | -{ | ||
| 39 | - [super didReceiveMemoryWarning]; | ||
| 40 | - // Dispose of any resources that can be recreated. | ||
| 41 | -} | ||
| 42 | - | ||
| 43 | // In a story board-based application, you will often want to do a little preparation before navigation | 13 | // In a story board-based application, you will often want to do a little preparation before navigation |
| 44 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender | 14 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender |
| 45 | { | 15 | { |
| @@ -50,7 +20,7 @@ | @@ -50,7 +20,7 @@ | ||
| 50 | 20 | ||
| 51 | if ([segue.identifier isEqualToString:@"lineChart"]) { | 21 | if ([segue.identifier isEqualToString:@"lineChart"]) { |
| 52 | 22 | ||
| 53 | - //Add LineChart | 23 | + //Add line chart |
| 54 | UILabel * lineChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, SCREEN_WIDTH, 30)]; | 24 | UILabel * lineChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, SCREEN_WIDTH, 30)]; |
| 55 | lineChartLabel.text = @"Line Chart"; | 25 | lineChartLabel.text = @"Line Chart"; |
| 56 | lineChartLabel.textColor = PNFreshGreen; | 26 | lineChartLabel.textColor = PNFreshGreen; |
| @@ -63,7 +33,7 @@ | @@ -63,7 +33,7 @@ | ||
| 63 | [lineChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]]; | 33 | [lineChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]]; |
| 64 | lineChart.showCoordinateAxis = YES; | 34 | lineChart.showCoordinateAxis = YES; |
| 65 | 35 | ||
| 66 | - // Line Chart Nr.1 | 36 | + // Line Chart #1 |
| 67 | NSArray * data01Array = @[@60.1, @160.1, @126.4, @262.2, @186.2, @127.2, @176.2]; | 37 | NSArray * data01Array = @[@60.1, @160.1, @126.4, @262.2, @186.2, @127.2, @176.2]; |
| 68 | PNLineChartData *data01 = [PNLineChartData new]; | 38 | PNLineChartData *data01 = [PNLineChartData new]; |
| 69 | data01.color = PNFreshGreen; | 39 | data01.color = PNFreshGreen; |
| @@ -74,7 +44,7 @@ | @@ -74,7 +44,7 @@ | ||
| 74 | return [PNLineChartDataItem dataItemWithY:yValue]; | 44 | return [PNLineChartDataItem dataItemWithY:yValue]; |
| 75 | }; | 45 | }; |
| 76 | 46 | ||
| 77 | - // Line Chart Nr.2 | 47 | + // Line Chart #2 |
| 78 | NSArray * data02Array = @[@20.1, @180.1, @26.4, @202.2, @126.2, @167.2, @276.2]; | 48 | NSArray * data02Array = @[@20.1, @180.1, @26.4, @202.2, @126.2, @167.2, @276.2]; |
| 79 | PNLineChartData *data02 = [PNLineChartData new]; | 49 | PNLineChartData *data02 = [PNLineChartData new]; |
| 80 | data02.color = PNTwitterColor; | 50 | data02.color = PNTwitterColor; |
| @@ -95,9 +65,9 @@ | @@ -95,9 +65,9 @@ | ||
| 95 | 65 | ||
| 96 | viewController.title = @"Line Chart"; | 66 | viewController.title = @"Line Chart"; |
| 97 | 67 | ||
| 98 | - }else if ([segue.identifier isEqualToString:@"barChart"]) | 68 | + } else if ([segue.identifier isEqualToString:@"barChart"]) |
| 99 | { | 69 | { |
| 100 | - //Add BarChart | 70 | + //Add bar chart |
| 101 | 71 | ||
| 102 | UILabel * barChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, SCREEN_WIDTH, 30)]; | 72 | UILabel * barChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, SCREEN_WIDTH, 30)]; |
| 103 | barChartLabel.text = @"Bar Chart"; | 73 | barChartLabel.text = @"Bar Chart"; |
| @@ -121,20 +91,15 @@ | @@ -121,20 +91,15 @@ | ||
| 121 | 91 | ||
| 122 | [self.barChart strokeChart]; | 92 | [self.barChart strokeChart]; |
| 123 | 93 | ||
| 124 | - | ||
| 125 | - | ||
| 126 | self.barChart.delegate = self; | 94 | self.barChart.delegate = self; |
| 127 | 95 | ||
| 128 | [viewController.view addSubview:barChartLabel]; | 96 | [viewController.view addSubview:barChartLabel]; |
| 129 | [viewController.view addSubview:self.barChart]; | 97 | [viewController.view addSubview:self.barChart]; |
| 130 | 98 | ||
| 131 | viewController.title = @"Bar Chart"; | 99 | viewController.title = @"Bar Chart"; |
| 132 | - }else if ([segue.identifier isEqualToString:@"circleChart"]) | 100 | + } else if ([segue.identifier isEqualToString:@"circleChart"]) |
| 133 | { | 101 | { |
| 134 | - | 102 | + //Add circle chart |
| 135 | - //Add CircleChart | ||
| 136 | - | ||
| 137 | - | ||
| 138 | UILabel * circleChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, SCREEN_WIDTH, 30)]; | 103 | UILabel * circleChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, SCREEN_WIDTH, 30)]; |
| 139 | circleChartLabel.text = @"Circle Chart"; | 104 | circleChartLabel.text = @"Circle Chart"; |
| 140 | circleChartLabel.textColor = PNFreshGreen; | 105 | circleChartLabel.textColor = PNFreshGreen; |
| @@ -156,25 +121,20 @@ | @@ -156,25 +121,20 @@ | ||
| 156 | [viewController.view addSubview:circleChart]; | 121 | [viewController.view addSubview:circleChart]; |
| 157 | viewController.title = @"Circle Chart"; | 122 | viewController.title = @"Circle Chart"; |
| 158 | 123 | ||
| 159 | - }else if ([segue.identifier isEqualToString:@"pieChart"]) | 124 | + } else if ([segue.identifier isEqualToString:@"pieChart"]) |
| 160 | { | 125 | { |
| 161 | - | 126 | + //Add pie chart |
| 162 | - //Add PieChart | ||
| 163 | UILabel * pieChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, SCREEN_WIDTH, 30)]; | 127 | UILabel * pieChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, SCREEN_WIDTH, 30)]; |
| 164 | pieChartLabel.text = @"Pie Chart"; | 128 | pieChartLabel.text = @"Pie Chart"; |
| 165 | pieChartLabel.textColor = PNFreshGreen; | 129 | pieChartLabel.textColor = PNFreshGreen; |
| 166 | pieChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0]; | 130 | pieChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0]; |
| 167 | pieChartLabel.textAlignment = NSTextAlignmentCenter; | 131 | pieChartLabel.textAlignment = NSTextAlignmentCenter; |
| 168 | 132 | ||
| 169 | - | ||
| 170 | - | ||
| 171 | NSArray *items = @[[PNPieChartDataItem dataItemWithValue:10 color:PNLightGreen], | 133 | NSArray *items = @[[PNPieChartDataItem dataItemWithValue:10 color:PNLightGreen], |
| 172 | [PNPieChartDataItem dataItemWithValue:20 color:PNFreshGreen description:@"WWDC"], | 134 | [PNPieChartDataItem dataItemWithValue:20 color:PNFreshGreen description:@"WWDC"], |
| 173 | - [PNPieChartDataItem dataItemWithValue:40 color:PNDeepGreen description:@"GOOL I/O"], | 135 | + [PNPieChartDataItem dataItemWithValue:40 color:PNDeepGreen description:@"GOOG I/O"], |
| 174 | ]; | 136 | ]; |
| 175 | 137 | ||
| 176 | - | ||
| 177 | - | ||
| 178 | PNPieChart *pieChart = [[PNPieChart alloc] initWithFrame:CGRectMake(40.0, 155.0, 240.0, 240.0) items:items]; | 138 | PNPieChart *pieChart = [[PNPieChart alloc] initWithFrame:CGRectMake(40.0, 155.0, 240.0, 240.0) items:items]; |
| 179 | pieChart.descriptionTextColor = [UIColor whiteColor]; | 139 | pieChart.descriptionTextColor = [UIColor whiteColor]; |
| 180 | pieChart.descriptionTextFont = [UIFont fontWithName:@"Avenir-Medium" size:14.0]; | 140 | pieChart.descriptionTextFont = [UIFont fontWithName:@"Avenir-Medium" size:14.0]; |
| @@ -186,16 +146,14 @@ | @@ -186,16 +146,14 @@ | ||
| 186 | [viewController.view addSubview:pieChart]; | 146 | [viewController.view addSubview:pieChart]; |
| 187 | 147 | ||
| 188 | viewController.title = @"Pie Chart"; | 148 | viewController.title = @"Pie Chart"; |
| 189 | - | ||
| 190 | } | 149 | } |
| 191 | - | ||
| 192 | } | 150 | } |
| 193 | 151 | ||
| 194 | --(void)userClickedOnLineKeyPoint:(CGPoint)point lineIndex:(NSInteger)lineIndex andPointIndex:(NSInteger)pointIndex{ | 152 | +- (void)userClickedOnLineKeyPoint:(CGPoint)point lineIndex:(NSInteger)lineIndex andPointIndex:(NSInteger)pointIndex{ |
| 195 | NSLog(@"Click Key on line %f, %f line index is %d and point index is %d",point.x, point.y,(int)lineIndex, (int)pointIndex); | 153 | NSLog(@"Click Key on line %f, %f line index is %d and point index is %d",point.x, point.y,(int)lineIndex, (int)pointIndex); |
| 196 | } | 154 | } |
| 197 | 155 | ||
| 198 | --(void)userClickedOnLinePoint:(CGPoint)point lineIndex:(NSInteger)lineIndex{ | 156 | +- (void)userClickedOnLinePoint:(CGPoint)point lineIndex:(NSInteger)lineIndex{ |
| 199 | NSLog(@"Click on line %f, %f, line index is %d",point.x, point.y, (int)lineIndex); | 157 | NSLog(@"Click on line %f, %f, line index is %d",point.x, point.y, (int)lineIndex); |
| 200 | } | 158 | } |
| 201 | 159 | ||
| @@ -206,23 +164,16 @@ | @@ -206,23 +164,16 @@ | ||
| 206 | 164 | ||
| 207 | PNBar * bar = [self.barChart.bars objectAtIndex:barIndex]; | 165 | PNBar * bar = [self.barChart.bars objectAtIndex:barIndex]; |
| 208 | 166 | ||
| 209 | - CABasicAnimation *animation= [CABasicAnimation animationWithKeyPath:@"transform.scale"]; | 167 | + CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; |
| 210 | - | ||
| 211 | - animation.fromValue= @1.0; | ||
| 212 | 168 | ||
| 169 | + animation.fromValue = @1.0; | ||
| 213 | animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | 170 | animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; |
| 214 | - | 171 | + animation.toValue = @1.1; |
| 215 | - animation.toValue= @1.1; | 172 | + animation.duration = 0.2; |
| 216 | - | ||
| 217 | - animation.duration= 0.2; | ||
| 218 | - | ||
| 219 | animation.repeatCount = 0; | 173 | animation.repeatCount = 0; |
| 220 | - | ||
| 221 | animation.autoreverses = YES; | 174 | animation.autoreverses = YES; |
| 222 | - | ||
| 223 | animation.removedOnCompletion = YES; | 175 | animation.removedOnCompletion = YES; |
| 224 | - | 176 | + animation.fillMode = kCAFillModeForwards; |
| 225 | - animation.fillMode=kCAFillModeForwards; | ||
| 226 | 177 | ||
| 227 | [bar.layer addAnimation:animation forKey:@"Float"]; | 178 | [bar.layer addAnimation:animation forKey:@"Float"]; |
| 228 | } | 179 | } |
-
Please register or login to post a comment