kevinzhow

Hide change value button on pie chart

@@ -43,6 +43,7 @@ @@ -43,6 +43,7 @@
43 </view> 43 </view>
44 <navigationItem key="navigationItem" title="PNChart" id="Ukg-Sg-E2z"/> 44 <navigationItem key="navigationItem" title="PNChart" id="Ukg-Sg-E2z"/>
45 <connections> 45 <connections>
  46 + <outlet property="changeValueButton" destination="L3F-13-Wf5" id="JnI-y3-Xpj"/>
46 <outlet property="titleLabel" destination="FUU-vZ-jMd" id="dA3-KC-Ht4"/> 47 <outlet property="titleLabel" destination="FUU-vZ-jMd" id="dA3-KC-Ht4"/>
47 </connections> 48 </connections>
48 </viewController> 49 </viewController>
@@ -15,8 +15,11 @@ @@ -15,8 +15,11 @@
15 @property (nonatomic) PNLineChart * lineChart; 15 @property (nonatomic) PNLineChart * lineChart;
16 @property (nonatomic) PNBarChart * barChart; 16 @property (nonatomic) PNBarChart * barChart;
17 @property (nonatomic) PNCircleChart * circleChart; 17 @property (nonatomic) PNCircleChart * circleChart;
  18 +@property (nonatomic) PNPieChart *pieChart;
  19 +
18 @property (weak, nonatomic) IBOutlet UILabel *titleLabel; 20 @property (weak, nonatomic) IBOutlet UILabel *titleLabel;
19 21
20 - (IBAction)changeValue:(id)sender; 22 - (IBAction)changeValue:(id)sender;
  23 +@property (weak, nonatomic) IBOutlet UIButton *changeValueButton;
21 24
22 @end 25 @end
@@ -101,6 +101,25 @@ @@ -101,6 +101,25 @@
101 101
102 [self.view addSubview:self.circleChart]; 102 [self.view addSubview:self.circleChart];
103 } 103 }
  104 + else if ([self.title isEqualToString:@"Pie Chart"])
  105 + {
  106 + self.titleLabel.text = @"Pie Chart";
  107 +
  108 + NSArray *items = @[[PNPieChartDataItem dataItemWithValue:10 color:PNLightGreen],
  109 + [PNPieChartDataItem dataItemWithValue:20 color:PNFreshGreen description:@"WWDC"],
  110 + [PNPieChartDataItem dataItemWithValue:40 color:PNDeepGreen description:@"GOOG I/O"],
  111 + ];
  112 +
  113 + self.pieChart = [[PNPieChart alloc] initWithFrame:CGRectMake(SCREEN_WIDTH /2.0 - 100, 135, 200.0, 200.0) items:items];
  114 + self.pieChart.descriptionTextColor = [UIColor whiteColor];
  115 + self.pieChart.descriptionTextFont = [UIFont fontWithName:@"Avenir-Medium" size:11.0];
  116 + self.pieChart.descriptionTextShadowColor = [UIColor clearColor];
  117 + [self.pieChart strokeChart];
  118 +
  119 +
  120 + [self.view addSubview:self.pieChart];
  121 + self.changeValueButton.hidden = YES;
  122 + }
104 } 123 }
105 124
106 125
@@ -7,9 +7,7 @@ @@ -7,9 +7,7 @@
7 // 7 //
8 8
9 #import <UIKit/UIKit.h> 9 #import <UIKit/UIKit.h>
10 -#import "PNChartDelegate.h"  
11 -#import "PNChart.h"  
12 10
13 -@interface PCChartsTableViewController : UITableViewController<PNChartDelegate> 11 +@interface PCChartsTableViewController : UITableViewController
14 12
15 @end 13 @end
@@ -38,39 +38,11 @@ @@ -38,39 +38,11 @@
38 } else if ([segue.identifier isEqualToString:@"pieChart"]) 38 } else if ([segue.identifier isEqualToString:@"pieChart"])
39 { 39 {
40 //Add pie chart 40 //Add pie chart
41 - UILabel * pieChartLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, SCREEN_WIDTH, 30)];  
42 - pieChartLabel.text = @"Pie Chart";  
43 - pieChartLabel.textColor = PNFreshGreen;  
44 - pieChartLabel.font = [UIFont fontWithName:@"Avenir-Medium" size:23.0];  
45 - pieChartLabel.textAlignment = NSTextAlignmentCenter;  
46 -  
47 - NSArray *items = @[[PNPieChartDataItem dataItemWithValue:10 color:PNLightGreen],  
48 - [PNPieChartDataItem dataItemWithValue:20 color:PNFreshGreen description:@"WWDC"],  
49 - [PNPieChartDataItem dataItemWithValue:40 color:PNDeepGreen description:@"GOOG I/O"],  
50 - ];  
51 -  
52 - PNPieChart *pieChart = [[PNPieChart alloc] initWithFrame:CGRectMake(SCREEN_WIDTH /2.0 - 100, 135, 200.0, 200.0) items:items];  
53 - pieChart.descriptionTextColor = [UIColor whiteColor];  
54 - pieChart.descriptionTextFont = [UIFont fontWithName:@"Avenir-Medium" size:11.0];  
55 - pieChart.descriptionTextShadowColor = [UIColor clearColor];  
56 - [pieChart strokeChart];  
57 -  
58 -  
59 - [viewController.view addSubview:pieChartLabel];  
60 - [viewController.view addSubview:pieChart];  
61 41
62 viewController.title = @"Pie Chart"; 42 viewController.title = @"Pie Chart";
63 } 43 }
64 } 44 }
65 45
66 -- (void)userClickedOnLineKeyPoint:(CGPoint)point lineIndex:(NSInteger)lineIndex pointIndex:(NSInteger)pointIndex{  
67 - NSLog(@"Click Key on line %f, %f line index is %d and point index is %d",point.x, point.y,(int)lineIndex, (int)pointIndex);  
68 -}  
69 -  
70 -- (void)userClickedOnLinePoint:(CGPoint)point lineIndex:(NSInteger)lineIndex{  
71 - NSLog(@"Click on line %f, %f, line index is %d",point.x, point.y, (int)lineIndex);  
72 -}  
73 -  
74 46
75 47
76 @end 48 @end