David Bleicher

Merge branch 'master' into CircleUpdateBug1

... ... @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#
s.name = "PNChart"
s.version = "0.8.3"
s.version = "0.8.5"
s.summary = "A simple and beautiful chart lib with animation used in Piner for iOS"
s.description = <<-DESC
... ... @@ -90,7 +90,7 @@ Pod::Spec.new do |s|
# Supports git, hg, bzr, svn and HTTP.
#
s.source = { :git => "https://github.com/kevinzhow/PNChart.git", :tag => "0.8.3" }
s.source = { :git => "https://github.com/kevinzhow/PNChart.git", :tag => "0.8.5" }
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
... ...
... ... @@ -76,27 +76,33 @@
if (_showLabel) {
[self __addYCoordinateLabelsValues];
} else {
[self processYMaxValue];
}
}
- (void)processYMaxValue {
NSArray *yAxisValues = _yLabels ? _yLabels : _yValues;
_yLabelSum = _yLabels ? _yLabels.count - 1 :_yLabelSum;
if (_yMaxValue) {
_yValueMax = _yMaxValue;
} else {
[self getYValueMax:yAxisValues];
}
if (_yLabelSum==4) {
_yLabelSum = yAxisValues.count;
(_yLabelSum % 2 == 0) ? _yLabelSum : _yLabelSum++;
}
}
#pragma mark - Private Method
#pragma mark - 添加柱状图的Y轴坐标
- (void)__addYCoordinateLabelsValues{
[self viewCleanupForCollection:_yChartLabels];
NSArray *yAxisValues = _yLabels ? _yLabels : _yValues;
_yLabelSum = _yLabels ? _yLabels.count - 1 :_yLabelSum;
if (_yMaxValue) {
_yValueMax = _yMaxValue;
} else {
[self getYValueMax:yAxisValues];
}
if (_yLabelSum==4) {
_yLabelSum = yAxisValues.count;
(_yLabelSum % 2 == 0) ? _yLabelSum : _yLabelSum++;
}
[self processYMaxValue];
float sectionHeight = (self.frame.size.height - _chartMargin * 2 - kXLabelHeight) / _yLabelSum;
for (int i = 0; i <= _yLabelSum; i++) {
... ...
... ... @@ -1026,7 +1026,7 @@
[self.layer addSublayer:textLayer];
[textLayer setFontSize:textheigt/2];
[textLayer setString:[[NSString alloc]initWithFormat:@"%ld",(NSInteger)(grade*100)]];
[textLayer setString:[[NSString alloc]initWithFormat:@"%d",(int)(grade*100)]];
[textLayer setFrame:CGRectMake(0, 0, textWidth, textheigt)];
[textLayer setPosition:CGPointMake(pointCenter.x, textStartPosY)];
textLayer.contentsScale = [UIScreen mainScreen].scale;
... ...
... ... @@ -94,6 +94,7 @@
self.titleLabel.text = @"Bar Chart";
self.barChart = [[PNBarChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)];
// self.barChart.showLabel = NO;
self.barChart.backgroundColor = [UIColor clearColor];
self.barChart.yLabelFormatter = ^(CGFloat yValue){
CGFloat yValueParsed = yValue;
... ... @@ -108,6 +109,7 @@
[self.barChart setStrokeColors:@[PNGreen,PNGreen,PNRed,PNGreen,PNGreen,PNGreen,PNRed,PNGreen]];
self.barChart.isGradientShow = NO;
self.barChart.isShowNumbers = NO;
[self.barChart strokeChart];
self.barChart.delegate = self;
... ...