David Bleicher

Merge remote-tracking branch 'kevinzhow/master'

@@ -16,7 +16,7 @@ Pod::Spec.new do |s| @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
16 # 16 #
17 17
18 s.name = "PNChart" 18 s.name = "PNChart"
19 - s.version = "0.8.3" 19 + s.version = "0.8.5"
20 s.summary = "A simple and beautiful chart lib with animation used in Piner for iOS" 20 s.summary = "A simple and beautiful chart lib with animation used in Piner for iOS"
21 21
22 s.description = <<-DESC 22 s.description = <<-DESC
@@ -90,7 +90,7 @@ Pod::Spec.new do |s| @@ -90,7 +90,7 @@ Pod::Spec.new do |s|
90 # Supports git, hg, bzr, svn and HTTP. 90 # Supports git, hg, bzr, svn and HTTP.
91 # 91 #
92 92
93 - s.source = { :git => "https://github.com/kevinzhow/PNChart.git", :tag => "0.8.3" } 93 + s.source = { :git => "https://github.com/kevinzhow/PNChart.git", :tag => "0.8.5" }
94 94
95 95
96 # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 96 # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
@@ -76,27 +76,33 @@ @@ -76,27 +76,33 @@
76 76
77 if (_showLabel) { 77 if (_showLabel) {
78 [self __addYCoordinateLabelsValues]; 78 [self __addYCoordinateLabelsValues];
  79 + } else {
  80 + [self processYMaxValue];
79 } 81 }
80 } 82 }
81 83
  84 +- (void)processYMaxValue {
  85 + NSArray *yAxisValues = _yLabels ? _yLabels : _yValues;
  86 + _yLabelSum = _yLabels ? _yLabels.count - 1 :_yLabelSum;
  87 + if (_yMaxValue) {
  88 + _yValueMax = _yMaxValue;
  89 + } else {
  90 + [self getYValueMax:yAxisValues];
  91 + }
  92 +
  93 + if (_yLabelSum==4) {
  94 + _yLabelSum = yAxisValues.count;
  95 + (_yLabelSum % 2 == 0) ? _yLabelSum : _yLabelSum++;
  96 + }
  97 +}
  98 +
82 #pragma mark - Private Method 99 #pragma mark - Private Method
83 #pragma mark - 添加柱状图的Y轴坐标 100 #pragma mark - 添加柱状图的Y轴坐标
84 - (void)__addYCoordinateLabelsValues{ 101 - (void)__addYCoordinateLabelsValues{
85 102
86 [self viewCleanupForCollection:_yChartLabels]; 103 [self viewCleanupForCollection:_yChartLabels];
87 104
88 - NSArray *yAxisValues = _yLabels ? _yLabels : _yValues; 105 + [self processYMaxValue];
89 - _yLabelSum = _yLabels ? _yLabels.count - 1 :_yLabelSum;  
90 - if (_yMaxValue) {  
91 - _yValueMax = _yMaxValue;  
92 - } else {  
93 - [self getYValueMax:yAxisValues];  
94 - }  
95 -  
96 - if (_yLabelSum==4) {  
97 - _yLabelSum = yAxisValues.count;  
98 - (_yLabelSum % 2 == 0) ? _yLabelSum : _yLabelSum++;  
99 - }  
100 106
101 float sectionHeight = (self.frame.size.height - _chartMargin * 2 - kXLabelHeight) / _yLabelSum; 107 float sectionHeight = (self.frame.size.height - _chartMargin * 2 - kXLabelHeight) / _yLabelSum;
102 for (int i = 0; i <= _yLabelSum; i++) { 108 for (int i = 0; i <= _yLabelSum; i++) {
@@ -1026,7 +1026,7 @@ @@ -1026,7 +1026,7 @@
1026 [self.layer addSublayer:textLayer]; 1026 [self.layer addSublayer:textLayer];
1027 [textLayer setFontSize:textheigt/2]; 1027 [textLayer setFontSize:textheigt/2];
1028 1028
1029 - [textLayer setString:[[NSString alloc]initWithFormat:@"%ld",(NSInteger)(grade*100)]]; 1029 + [textLayer setString:[[NSString alloc]initWithFormat:@"%d",(int)(grade*100)]];
1030 [textLayer setFrame:CGRectMake(0, 0, textWidth, textheigt)]; 1030 [textLayer setFrame:CGRectMake(0, 0, textWidth, textheigt)];
1031 [textLayer setPosition:CGPointMake(pointCenter.x, textStartPosY)]; 1031 [textLayer setPosition:CGPointMake(pointCenter.x, textStartPosY)];
1032 textLayer.contentsScale = [UIScreen mainScreen].scale; 1032 textLayer.contentsScale = [UIScreen mainScreen].scale;
@@ -94,6 +94,7 @@ @@ -94,6 +94,7 @@
94 self.titleLabel.text = @"Bar Chart"; 94 self.titleLabel.text = @"Bar Chart";
95 95
96 self.barChart = [[PNBarChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)]; 96 self.barChart = [[PNBarChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)];
  97 +// self.barChart.showLabel = NO;
97 self.barChart.backgroundColor = [UIColor clearColor]; 98 self.barChart.backgroundColor = [UIColor clearColor];
98 self.barChart.yLabelFormatter = ^(CGFloat yValue){ 99 self.barChart.yLabelFormatter = ^(CGFloat yValue){
99 CGFloat yValueParsed = yValue; 100 CGFloat yValueParsed = yValue;
@@ -108,6 +109,7 @@ @@ -108,6 +109,7 @@
108 [self.barChart setStrokeColors:@[PNGreen,PNGreen,PNRed,PNGreen,PNGreen,PNGreen,PNRed,PNGreen]]; 109 [self.barChart setStrokeColors:@[PNGreen,PNGreen,PNRed,PNGreen,PNGreen,PNGreen,PNRed,PNGreen]];
109 self.barChart.isGradientShow = NO; 110 self.barChart.isGradientShow = NO;
110 self.barChart.isShowNumbers = NO; 111 self.barChart.isShowNumbers = NO;
  112 +
111 [self.barChart strokeChart]; 113 [self.barChart strokeChart];
112 114
113 self.barChart.delegate = self; 115 self.barChart.delegate = self;