olunx

Merge commit '8cf1b7c8'

Conflicts:
	PNChart/PNGenericChart.h
	PNChartDemo/PCChartViewController.m
@@ -27,4 +27,7 @@ @@ -27,4 +27,7 @@
27 */ 27 */
28 - (void)userClickedOnBarAtIndex:(NSInteger)barIndex; 28 - (void)userClickedOnBarAtIndex:(NSInteger)barIndex;
29 29
  30 +
  31 +- (void)userClickedOnPieIndexItem:(NSInteger)pieIndex;
  32 +- (void)didUnselectPieItem;
30 @end 33 @end
@@ -25,8 +25,10 @@ typedef NS_ENUM(NSUInteger, PNLegendItemStyle) { @@ -25,8 +25,10 @@ typedef NS_ENUM(NSUInteger, PNLegendItemStyle) {
25 @property (assign, nonatomic) BOOL hasLegend; 25 @property (assign, nonatomic) BOOL hasLegend;
26 @property (assign, nonatomic) PNLegendPosition legendPosition; 26 @property (assign, nonatomic) PNLegendPosition legendPosition;
27 @property (assign, nonatomic) PNLegendItemStyle legendStyle; 27 @property (assign, nonatomic) PNLegendItemStyle legendStyle;
  28 +
28 @property (assign, nonatomic) UIFont *legendFont; 29 @property (assign, nonatomic) UIFont *legendFont;
29 @property (assign, nonatomic) UIColor *legendFontColor; 30 @property (assign, nonatomic) UIColor *legendFontColor;
  31 +@property (assign, nonatomic) NSUInteger labelRowsInSerialMode;
30 32
31 /** 33 /**
32 * returns the Legend View, or nil if no chart data is present. 34 * returns the Legend View, or nil if no chart data is present.
@@ -38,4 +40,6 @@ typedef NS_ENUM(NSUInteger, PNLegendItemStyle) { @@ -38,4 +40,6 @@ typedef NS_ENUM(NSUInteger, PNLegendItemStyle) {
38 */ 40 */
39 - (UIView*) getLegendWithMaxWidth:(CGFloat)mWidth; 41 - (UIView*) getLegendWithMaxWidth:(CGFloat)mWidth;
40 42
  43 +
  44 +- (void) setupDefaultValues;
41 @end 45 @end
@@ -24,37 +24,11 @@ @@ -24,37 +24,11 @@
24 } 24 }
25 */ 25 */
26 26
27 -- (UIView*) drawLegend{  
28 - return nil;  
29 -}  
30 -  
31 -  
32 -- (id)initWithCoder:(NSCoder *)coder  
33 -{  
34 - self = [super initWithCoder:coder];  
35 -  
36 - if (self) {  
37 - [self setupDefaultValues];  
38 - }  
39 -  
40 - return self;  
41 -}  
42 -  
43 -- (id)initWithFrame:(CGRect)frame  
44 -{  
45 - self = [super initWithFrame:frame];  
46 -  
47 - if (self) {  
48 - [self setupDefaultValues];  
49 - }  
50 -  
51 - return self;  
52 -}  
53 -  
54 - (void) setupDefaultValues{ 27 - (void) setupDefaultValues{
55 self.hasLegend = YES; 28 self.hasLegend = YES;
56 self.legendPosition = PNLegendPositionBottom; 29 self.legendPosition = PNLegendPositionBottom;
57 self.legendStyle = PNLegendItemStyleStacked; 30 self.legendStyle = PNLegendItemStyleStacked;
  31 + self.labelRowsInSerialMode = 1;
58 } 32 }
59 33
60 34
@@ -67,6 +41,13 @@ @@ -67,6 +41,13 @@
67 return nil; 41 return nil;
68 } 42 }
69 43
  44 +- (void) setLabelRowsInSerialMode:(NSUInteger)num{
  45 + if (self.legendStyle == PNLegendItemStyleSerial) {
  46 + _labelRowsInSerialMode = num;
  47 + }else{
  48 + _labelRowsInSerialMode = 1;
  49 + }
  50 +}
70 51
71 52
72 @end 53 @end
@@ -66,7 +66,6 @@ @@ -66,7 +66,6 @@
66 _yChartLabels = [NSMutableArray new]; 66 _yChartLabels = [NSMutableArray new];
67 } 67 }
68 68
69 -#warning modify origin  
70 if (yStep == 0.0) { 69 if (yStep == 0.0) {
71 PNChartLabel *minLabel = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, (NSInteger)_chartCavanHeight, (NSInteger)_chartMargin, (NSInteger)_yLabelHeight)]; 70 PNChartLabel *minLabel = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, (NSInteger)_chartCavanHeight, (NSInteger)_chartMargin, (NSInteger)_yLabelHeight)];
72 minLabel.text = [NSString stringWithFormat:yLabelFormat, 0.0]; 71 minLabel.text = [NSString stringWithFormat:yLabelFormat, 0.0];
@@ -197,7 +196,6 @@ @@ -197,7 +196,6 @@
197 for (int index = 0; index < xLabels.count; index++) { 196 for (int index = 0; index < xLabels.count; index++) {
198 labelText = xLabels[index]; 197 labelText = xLabels[index];
199 198
200 -#warning modify origin  
201 NSInteger x = 2 * _chartMargin + (index * _xLabelWidth) - (_xLabelWidth / 2); 199 NSInteger x = 2 * _chartMargin + (index * _xLabelWidth) - (_xLabelWidth / 2);
202 NSInteger y = _chartMargin + _chartCavanHeight; 200 NSInteger y = _chartMargin + _chartCavanHeight;
203 201
@@ -403,7 +401,6 @@ @@ -403,7 +401,6 @@
403 401
404 CGFloat offSetX = (_chartCavanWidth) / (chartData.itemCount); 402 CGFloat offSetX = (_chartCavanWidth) / (chartData.itemCount);
405 403
406 -#warning modify chart path  
407 int x = 2 * _chartMargin + (i * offSetX); 404 int x = 2 * _chartMargin + (i * offSetX);
408 int y = _chartCavanHeight - (innerGrade * _chartCavanHeight) + (_yLabelHeight / 2); 405 int y = _chartCavanHeight - (innerGrade * _chartCavanHeight) + (_yLabelHeight / 2);
409 406
@@ -652,7 +649,6 @@ @@ -652,7 +649,6 @@
652 - (void)drawRect:(CGRect)rect 649 - (void)drawRect:(CGRect)rect
653 { 650 {
654 if (self.isShowCoordinateAxis) { 651 if (self.isShowCoordinateAxis) {
655 -#warning modify  
656 CGFloat yAxisOffset = 10.f; 652 CGFloat yAxisOffset = 10.f;
657 653
658 CGContextRef ctx = UIGraphicsGetCurrentContext(); 654 CGContextRef ctx = UIGraphicsGetCurrentContext();
@@ -726,6 +722,7 @@ @@ -726,6 +722,7 @@
726 722
727 - (void)setupDefaultValues 723 - (void)setupDefaultValues
728 { 724 {
  725 + [super setupDefaultValues];
729 // Initialization code 726 // Initialization code
730 self.backgroundColor = [UIColor whiteColor]; 727 self.backgroundColor = [UIColor whiteColor];
731 self.clipsToBounds = YES; 728 self.clipsToBounds = YES;
@@ -807,15 +804,15 @@ @@ -807,15 +804,15 @@
807 CGFloat x = 0; 804 CGFloat x = 0;
808 CGFloat y = 0; 805 CGFloat y = 0;
809 806
810 - /* accumulated width and height */ 807 + /* accumulated height */
811 - CGFloat totalWidth = 0;  
812 CGFloat totalHeight = 0; 808 CGFloat totalHeight = 0;
813 809
814 NSMutableArray *legendViews = [[NSMutableArray alloc] init]; 810 NSMutableArray *legendViews = [[NSMutableArray alloc] init];
815 811
  812 + NSUInteger numLabelsPerRow = ceil((float)[self.chartData count] / self.labelRowsInSerialMode);
816 813
817 /* Determine the max width of each legend item */ 814 /* Determine the max width of each legend item */
818 - CGFloat maxLabelWidth = self.legendStyle == PNLegendItemStyleStacked ? (mWidth - legendLineWidth) : (mWidth / [self.chartData count] - legendLineWidth); 815 + CGFloat maxLabelWidth = self.legendStyle == PNLegendItemStyleStacked ? (mWidth - legendLineWidth) : (mWidth / numLabelsPerRow - legendLineWidth);
819 816
820 /* this is used when labels wrap text and the line 817 /* this is used when labels wrap text and the line
821 * should be in the middle of the first row */ 818 * should be in the middle of the first row */
@@ -823,6 +820,9 @@ @@ -823,6 +820,9 @@
823 withWidth:MAXFLOAT 820 withWidth:MAXFLOAT
824 font:self.legendFont ? self.legendFont : [UIFont systemFontOfSize:12.0f]].height; 821 font:self.legendFont ? self.legendFont : [UIFont systemFontOfSize:12.0f]].height;
825 822
  823 + NSUInteger counter = 0;
  824 + NSUInteger rowMaxHeight = 0;
  825 +
826 for (PNLineChartData *pdata in self.chartData) { 826 for (PNLineChartData *pdata in self.chartData) {
827 /* Expected label size*/ 827 /* Expected label size*/
828 CGSize labelsize = [PNLineChart sizeOfString:pdata.dataTitle 828 CGSize labelsize = [PNLineChart sizeOfString:pdata.dataTitle
@@ -831,6 +831,11 @@ @@ -831,6 +831,11 @@
831 831
832 /* draw lines */ 832 /* draw lines */
833 833
  834 + if (counter != 0 && counter % numLabelsPerRow == 0) {
  835 + x = 0;
  836 + y += rowMaxHeight;
  837 + rowMaxHeight = 0;
  838 + }
834 839
835 /* If there is inflection decorator, the line is composed of two lines 840 /* If there is inflection decorator, the line is composed of two lines
836 * and this is the space that separates two lines in order to put inflection 841 * and this is the space that separates two lines in order to put inflection
@@ -873,16 +878,18 @@ @@ -873,16 +878,18 @@
873 label.font = self.legendFont ? self.legendFont : [UIFont systemFontOfSize:12.0f]; 878 label.font = self.legendFont ? self.legendFont : [UIFont systemFontOfSize:12.0f];
874 label.lineBreakMode = NSLineBreakByWordWrapping; 879 label.lineBreakMode = NSLineBreakByWordWrapping;
875 label.numberOfLines = 0; 880 label.numberOfLines = 0;
  881 +
  882 + rowMaxHeight = fmaxf(rowMaxHeight, labelsize.height);
876 x += self.legendStyle == PNLegendItemStyleStacked ? 0 : labelsize.width + legendLineWidth; 883 x += self.legendStyle == PNLegendItemStyleStacked ? 0 : labelsize.width + legendLineWidth;
877 y += self.legendStyle == PNLegendItemStyleStacked ? labelsize.height : 0; 884 y += self.legendStyle == PNLegendItemStyleStacked ? labelsize.height : 0;
878 885
879 - totalWidth = self.legendStyle == PNLegendItemStyleStacked ? fmaxf(totalWidth, labelsize.width + legendLineWidth) : totalWidth + labelsize.width + legendLineWidth;  
880 - totalHeight = self.legendStyle == PNLegendItemStyleStacked ? fmaxf(totalHeight, labelsize.height) : totalHeight + labelsize.height;  
881 - [legendViews addObject:label];  
882 886
  887 + totalHeight = self.legendStyle == PNLegendItemStyleStacked ? fmaxf(totalHeight, rowMaxHeight + y) : totalHeight + labelsize.height;
  888 + [legendViews addObject:label];
  889 + counter++;
883 } 890 }
884 891
885 - UIView *legend = [[UIView alloc] initWithFrame:CGRectMake(0, 0, totalWidth, totalHeight)]; 892 + UIView *legend = [[UIView alloc] initWithFrame:CGRectMake(0, 0, mWidth, totalHeight)];
886 893
887 for (UIView* v in legendViews) { 894 for (UIView* v in legendViews) {
888 [legend addSubview:v]; 895 [legend addSubview:v];
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 #import <UIKit/UIKit.h> 9 #import <UIKit/UIKit.h>
10 #import "PNPieChartDataItem.h" 10 #import "PNPieChartDataItem.h"
11 #import "PNGenericChart.h" 11 #import "PNGenericChart.h"
  12 +#import "PNChartDelegate.h"
12 13
13 @interface PNPieChart : PNGenericChart 14 @interface PNPieChart : PNGenericChart
14 15
@@ -34,10 +35,11 @@ @@ -34,10 +35,11 @@
34 /** Show only values, this is useful when legend is present */ 35 /** Show only values, this is useful when legend is present */
35 @property (nonatomic) BOOL showOnlyValues; 36 @property (nonatomic) BOOL showOnlyValues;
36 37
37 -  
38 /** Show absolute values not relative i.e. percentages */ 38 /** Show absolute values not relative i.e. percentages */
39 @property (nonatomic) BOOL showAbsoluteValues; 39 @property (nonatomic) BOOL showAbsoluteValues;
40 40
  41 +@property (nonatomic, weak) id<PNChartDelegate> delegate;
  42 +
41 - (void)strokeChart; 43 - (void)strokeChart;
42 44
43 @end 45 @end
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 @property (nonatomic) UIView *contentView; 21 @property (nonatomic) UIView *contentView;
22 @property (nonatomic) CAShapeLayer *pieLayer; 22 @property (nonatomic) CAShapeLayer *pieLayer;
23 @property (nonatomic) NSMutableArray *descriptionLabels; 23 @property (nonatomic) NSMutableArray *descriptionLabels;
24 - 24 +@property (strong, nonatomic) CAShapeLayer *sectorHighlight;
25 25
26 - (void)loadDefault; 26 - (void)loadDefault;
27 27
@@ -57,6 +57,7 @@ @@ -57,6 +57,7 @@
57 _descriptionTextShadowOffset = CGSizeMake(0, 1); 57 _descriptionTextShadowOffset = CGSizeMake(0, 1);
58 _duration = 1.0; 58 _duration = 1.0;
59 59
  60 + [super setupDefaultValues];
60 [self loadDefault]; 61 [self loadDefault];
61 } 62 }
62 63
@@ -101,6 +102,7 @@ @@ -101,6 +102,7 @@
101 102
102 CGFloat radius = _innerCircleRadius + (_outerCircleRadius - _innerCircleRadius) / 2; 103 CGFloat radius = _innerCircleRadius + (_outerCircleRadius - _innerCircleRadius) / 2;
103 CGFloat borderWidth = _outerCircleRadius - _innerCircleRadius; 104 CGFloat borderWidth = _outerCircleRadius - _innerCircleRadius;
  105 +
104 CAShapeLayer *currentPieLayer = [self newCircleLayerWithRadius:radius 106 CAShapeLayer *currentPieLayer = [self newCircleLayerWithRadius:radius
105 borderWidth:borderWidth 107 borderWidth:borderWidth
106 fillColor:[UIColor clearColor] 108 fillColor:[UIColor clearColor]
@@ -251,13 +253,78 @@ @@ -251,13 +253,78 @@
251 }]; 253 }];
252 } 254 }
253 255
  256 +- (void)didTouchAt:(CGPoint)touchLocation
  257 +{
  258 + CGPoint circleCenter = CGPointMake(_contentView.bounds.size.width/2, _contentView.bounds.size.height/2);
  259 +
  260 + CGFloat distanceFromCenter = sqrtf(powf((touchLocation.y - circleCenter.y),2) + powf((touchLocation.x - circleCenter.x),2));
  261 +
  262 + if (distanceFromCenter < _innerCircleRadius) {
  263 + if ([self.delegate respondsToSelector:@selector(didUnselectPieItem)]) {
  264 + [self.delegate didUnselectPieItem];
  265 + }
  266 + [self.sectorHighlight removeFromSuperlayer];
  267 + return;
  268 + }
  269 +
  270 + CGFloat percentage = [self findPercentageOfAngleInCircle:circleCenter fromPoint:touchLocation];
  271 + int index = 0;
  272 + while (percentage > [self endPercentageForItemAtIndex:index]) {
  273 + index ++;
  274 + }
  275 +
  276 + if ([self.delegate respondsToSelector:@selector(userClickedOnPieIndexItem:)]) {
  277 + [self.delegate userClickedOnPieIndexItem:index];
  278 + }
  279 +
  280 + if (self.sectorHighlight) {
  281 + [self.sectorHighlight removeFromSuperlayer];
  282 + }
  283 + PNPieChartDataItem *currentItem = [self dataItemForIndex:index];
  284 +
  285 + CGFloat red,green,blue,alpha;
  286 + UIColor *old = currentItem.color;
  287 + [old getRed:&red green:&green blue:&blue alpha:&alpha];
  288 + alpha /= 2;
  289 + UIColor *newColor = [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
  290 +
  291 + CGFloat startPercnetage = [self startPercentageForItemAtIndex:index];
  292 + CGFloat endPercentage = [self endPercentageForItemAtIndex:index];
  293 + self.sectorHighlight = [self newCircleLayerWithRadius:_outerCircleRadius + 5
  294 + borderWidth:10
  295 + fillColor:[UIColor clearColor]
  296 + borderColor:newColor
  297 + startPercentage:startPercnetage
  298 + endPercentage:endPercentage];
  299 + [_contentView.layer addSublayer:self.sectorHighlight];
  300 +}
  301 +
  302 +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
  303 +{
  304 + for (UITouch *touch in touches) {
  305 + CGPoint touchLocation = [touch locationInView:_contentView];
  306 + [self didTouchAt:touchLocation];
  307 + }
  308 +}
  309 +
  310 +- (CGFloat) findPercentageOfAngleInCircle:(CGPoint)center fromPoint:(CGPoint)reference{
  311 + //Find angle of line Passing In Reference And Center
  312 + CGFloat angleOfLine = atanf((reference.y - center.y) / (reference.x - center.x));
  313 + CGFloat percentage = (angleOfLine + M_PI/2)/(2 * M_PI);
  314 + return (reference.x - center.x) > 0 ? percentage : percentage + .5;
  315 +}
  316 +
254 - (UIView*) getLegendWithMaxWidth:(CGFloat)mWidth{ 317 - (UIView*) getLegendWithMaxWidth:(CGFloat)mWidth{
255 if ([self.items count] < 1) { 318 if ([self.items count] < 1) {
256 return nil; 319 return nil;
257 } 320 }
258 321
259 /* This is a small circle that refers to the chart data */ 322 /* This is a small circle that refers to the chart data */
260 - CGFloat legendCircle = 10; 323 + CGFloat legendCircle = 16;
  324 +
  325 + CGFloat hSpacing = 0;
  326 +
  327 + CGFloat beforeLabel = legendCircle + hSpacing;
261 328
262 /* x and y are the coordinates of the starting point of each legend item */ 329 /* x and y are the coordinates of the starting point of each legend item */
263 CGFloat x = 0; 330 CGFloat x = 0;
@@ -269,9 +336,13 @@ @@ -269,9 +336,13 @@
269 336
270 NSMutableArray *legendViews = [[NSMutableArray alloc] init]; 337 NSMutableArray *legendViews = [[NSMutableArray alloc] init];
271 338
272 -  
273 /* Determine the max width of each legend item */ 339 /* Determine the max width of each legend item */
274 - CGFloat maxLabelWidth = self.legendStyle == PNLegendItemStyleStacked ? (mWidth - legendCircle) : (mWidth / [self.items count] - legendCircle); 340 + CGFloat maxLabelWidth;
  341 + if (self.legendStyle == PNLegendItemStyleStacked) {
  342 + maxLabelWidth = mWidth - beforeLabel;
  343 + }else{
  344 + maxLabelWidth = MAXFLOAT;
  345 + }
275 346
276 /* this is used when labels wrap text and the line 347 /* this is used when labels wrap text and the line
277 * should be in the middle of the first row */ 348 * should be in the middle of the first row */
@@ -279,30 +350,46 @@ @@ -279,30 +350,46 @@
279 withWidth:MAXFLOAT 350 withWidth:MAXFLOAT
280 font:self.legendFont ? self.legendFont : [UIFont systemFontOfSize:12.0f]].height; 351 font:self.legendFont ? self.legendFont : [UIFont systemFontOfSize:12.0f]].height;
281 352
  353 + NSUInteger counter = 0;
  354 + NSUInteger rowWidth = 0;
  355 + NSUInteger rowMaxHeight = 0;
  356 +
282 for (PNPieChartDataItem *pdata in self.items) { 357 for (PNPieChartDataItem *pdata in self.items) {
283 /* Expected label size*/ 358 /* Expected label size*/
284 CGSize labelsize = [PNLineChart sizeOfString:pdata.textDescription 359 CGSize labelsize = [PNLineChart sizeOfString:pdata.textDescription
285 withWidth:maxLabelWidth 360 withWidth:maxLabelWidth
286 font:self.legendFont ? self.legendFont : [UIFont systemFontOfSize:12.0f]]; 361 font:self.legendFont ? self.legendFont : [UIFont systemFontOfSize:12.0f]];
287 362
288 - 363 + if ((rowWidth + labelsize.width + beforeLabel > mWidth)&&(self.legendStyle == PNLegendItemStyleSerial)) {
  364 + rowWidth = 0;
  365 + x = 0;
  366 + y += rowMaxHeight;
  367 + rowMaxHeight = 0;
  368 + }
  369 + rowWidth += labelsize.width + beforeLabel;
  370 + totalWidth = self.legendStyle == PNLegendItemStyleSerial ? fmaxf(rowWidth, totalWidth) : fmaxf(totalWidth, labelsize.width + beforeLabel);
289 // Add inflexion type 371 // Add inflexion type
290 - [legendViews addObject:[self drawInflexion:legendCircle * .8 372 + [legendViews addObject:[self drawInflexion:legendCircle * .6
291 center:CGPointMake(x + legendCircle / 2, y + singleRowHeight / 2) 373 center:CGPointMake(x + legendCircle / 2, y + singleRowHeight / 2)
292 andColor:pdata.color]]; 374 andColor:pdata.color]];
293 375
294 - UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(x + legendCircle, y, maxLabelWidth, labelsize.height)]; 376 +
  377 + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(x + beforeLabel, y, labelsize.width, labelsize.height)];
295 label.text = pdata.textDescription; 378 label.text = pdata.textDescription;
296 label.textColor = self.legendFontColor ? self.legendFontColor : [UIColor blackColor]; 379 label.textColor = self.legendFontColor ? self.legendFontColor : [UIColor blackColor];
297 label.font = self.legendFont ? self.legendFont : [UIFont systemFontOfSize:12.0f]; 380 label.font = self.legendFont ? self.legendFont : [UIFont systemFontOfSize:12.0f];
298 label.lineBreakMode = NSLineBreakByWordWrapping; 381 label.lineBreakMode = NSLineBreakByWordWrapping;
299 label.numberOfLines = 0; 382 label.numberOfLines = 0;
300 - x += self.legendStyle == PNLegendItemStyleStacked ? 0 : labelsize.width + legendCircle; 383 +
  384 +
  385 + rowMaxHeight = fmaxf(rowMaxHeight, labelsize.height);
  386 + x += self.legendStyle == PNLegendItemStyleStacked ? 0 : labelsize.width + beforeLabel;
301 y += self.legendStyle == PNLegendItemStyleStacked ? labelsize.height : 0; 387 y += self.legendStyle == PNLegendItemStyleStacked ? labelsize.height : 0;
302 388
303 - totalWidth = self.legendStyle == PNLegendItemStyleStacked ? fmaxf(totalWidth, labelsize.width + legendCircle) : totalWidth + labelsize.width + legendCircle; 389 +
304 - totalHeight = self.legendStyle == PNLegendItemStyleStacked ? fmaxf(totalHeight, labelsize.height) : totalHeight + labelsize.height; 390 + totalHeight = self.legendStyle == PNLegendItemStyleSerial ? fmaxf(totalHeight, rowMaxHeight + y) : totalHeight + labelsize.height;
305 [legendViews addObject:label]; 391 [legendViews addObject:label];
  392 + counter ++;
306 } 393 }
307 394
308 UIView *legend = [[UIView alloc] initWithFrame:CGRectMake(0, 0, totalWidth, totalHeight)]; 395 UIView *legend = [[UIView alloc] initWithFrame:CGRectMake(0, 0, totalWidth, totalHeight)];
@@ -20,6 +20,7 @@ @@ -20,6 +20,7 @@
20 self.rightSwitch.hidden = YES; 20 self.rightSwitch.hidden = YES;
21 self.leftLabel.hidden = YES; 21 self.leftLabel.hidden = YES;
22 self.rightLabel.hidden = YES; 22 self.rightLabel.hidden = YES;
  23 + self.changeValueButton.hidden = YES;
23 24
24 if ([self.title isEqualToString:@"Line Chart"]) { 25 if ([self.title isEqualToString:@"Line Chart"]) {
25 26
@@ -67,7 +68,7 @@ @@ -67,7 +68,7 @@
67 data02.color = PNTwitterColor; 68 data02.color = PNTwitterColor;
68 data02.alpha = 0.5f; 69 data02.alpha = 0.5f;
69 data02.itemCount = data02Array.count; 70 data02.itemCount = data02Array.count;
70 - data02.inflexionPointStyle = PNLineChartPointStyleNone; 71 + data02.inflexionPointStyle = PNLineChartPointStyleCircle;
71 data02.getData = ^(NSUInteger index) { 72 data02.getData = ^(NSUInteger index) {
72 CGFloat yValue = [data02Array[index] floatValue]; 73 CGFloat yValue = [data02Array[index] floatValue];
73 return [PNLineChartDataItem dataItemWithY:yValue]; 74 return [PNLineChartDataItem dataItemWithY:yValue];
@@ -79,12 +80,13 @@ @@ -79,12 +80,13 @@
79 80
80 81
81 [self.view addSubview:self.lineChart]; 82 [self.view addSubview:self.lineChart];
  83 +
82 self.lineChart.legendStyle = PNLegendItemStyleStacked; 84 self.lineChart.legendStyle = PNLegendItemStyleStacked;
83 self.lineChart.legendFont = [UIFont boldSystemFontOfSize:12.0f]; 85 self.lineChart.legendFont = [UIFont boldSystemFontOfSize:12.0f];
84 self.lineChart.legendFontColor = [UIColor redColor]; 86 self.lineChart.legendFontColor = [UIColor redColor];
85 87
86 - UIView *legend = [self.lineChart getLegendWithMaxWidth:200]; 88 + UIView *legend = [self.lineChart getLegendWithMaxWidth:320];
87 - [legend setFrame:CGRectMake(100, 400, legend.frame.size.width, legend.frame.size.width)]; 89 + [legend setFrame:CGRectMake(30, 340, legend.frame.size.width, legend.frame.size.width)];
88 [self.view addSubview:legend]; 90 [self.view addSubview:legend];
89 } 91 }
90 else if ([self.title isEqualToString:@"Bar Chart"]) 92 else if ([self.title isEqualToString:@"Bar Chart"])
@@ -157,7 +159,7 @@ @@ -157,7 +159,7 @@
157 self.pieChart.legendFont = [UIFont boldSystemFontOfSize:12.0f]; 159 self.pieChart.legendFont = [UIFont boldSystemFontOfSize:12.0f];
158 160
159 UIView *legend = [self.pieChart getLegendWithMaxWidth:200]; 161 UIView *legend = [self.pieChart getLegendWithMaxWidth:200];
160 - [legend setFrame:CGRectMake(100, 400, legend.frame.size.width, legend.frame.size.width)]; 162 + [legend setFrame:CGRectMake(130, 350, legend.frame.size.width, legend.frame.size.height)];
161 [self.view addSubview:legend]; 163 [self.view addSubview:legend];
162 164
163 [self.view addSubview:self.pieChart]; 165 [self.view addSubview:self.pieChart];