Kevin

Merge pull request #211 from dullgrass/master

Add the new feature that supports show the negative numbers
... ... @@ -11,9 +11,12 @@
@interface PNBar : UIView
- (void)rollBack;
@property (nonatomic) float grade;
@property (nonatomic) float maxDivisor;
@property (nonatomic) CAShapeLayer *chartLine;
@property (nonatomic) UIColor *barColor;
@property (nonatomic) UIColor *barColorGradientStart;
... ... @@ -23,5 +26,6 @@
@property (nonatomic) CAShapeLayer *gradeLayer;
@property (nonatomic) CATextLayer* textLayer;
@property (nonatomic, assign) BOOL isNegative; //!< 是否是负数
@property (nonatomic, assign) BOOL isShowNumber; //!< 是否显示numbers
@end
... ...
... ... @@ -10,6 +10,12 @@
#import "PNColor.h"
#import <CoreText/CoreText.h>
@interface PNBar ()
@property (nonatomic) float copyGrade;
@end
@implementation PNBar
- (id)initWithFrame:(CGRect)frame
... ... @@ -39,8 +45,7 @@
- (void)setGrade:(float)grade
{
// NSLog(@"New garde %f",grade);
_copyGrade = grade;
CGFloat startPosY = (1 - grade) * self.frame.size.height;
UIBezierPath *progressline = [UIBezierPath bezierPath];
... ... @@ -76,9 +81,7 @@
// Add gradient
[self.gradientMask addAnimation:pathAnimation forKey:@"animationKey"];
self.gradientMask.path = progressline.CGPath;
// add text
[self setGradeFrame:grade startPosY:startPosY];
CABasicAnimation* opacityAnimation = [self fadeAnimation];
[self.textLayer addAnimation:opacityAnimation forKey:nil];
... ... @@ -108,13 +111,14 @@
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.startPoint = CGPointMake(0.5,1.0);
gradientLayer.endPoint = CGPointMake(0.5,0.0);
gradientLayer.startPoint = CGPointMake(0.0,0.0);
gradientLayer.endPoint = CGPointMake(1.0 ,0.0);
gradientLayer.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height);
UIColor *endColor = (_barColor ? _barColor : [UIColor greenColor]);
UIColor *middleColor = [UIColor colorWithWhite:255/255 alpha:0.8];
NSArray *colors = @[
(id)_barColorGradientStart.CGColor,
(id)endColor.CGColor
(__bridge id)self.barColor.CGColor,
(__bridge id)middleColor.CGColor,
(__bridge id)self.barColor.CGColor
];
gradientLayer.colors = colors;
... ... @@ -124,9 +128,7 @@
self.gradientMask.strokeEnd = 1.0;
[self.gradientMask addAnimation:pathAnimation forKey:@"strokeEndAnimation"];
//set grade
[self setGradeFrame:grade startPosY:startPosY];
CABasicAnimation* opacityAnimation = [self fadeAnimation];
[self.textLayer addAnimation:opacityAnimation forKey:nil];
}
... ... @@ -179,7 +181,9 @@
_textLayer = [[CATextLayer alloc]init];
[_textLayer setString:@"0"];
[_textLayer setAlignmentMode:kCAAlignmentCenter];
[_textLayer setForegroundColor:[[UIColor grayColor] CGColor]];
[_textLayer setForegroundColor:[[UIColor colorWithRed:178/255.0 green:178/255. blue:178/255.0 alpha:1.0] CGColor]];
_textLayer.hidden = YES;
}
return _textLayer;
... ... @@ -187,27 +191,67 @@
-(void)setGradeFrame:(CGFloat)grade startPosY:(CGFloat)startPosY
{
CGFloat textheigt = self.bounds.size.width;
CGFloat textheigt = self.bounds.size.height*self.grade;
CGFloat topSpace = self.bounds.size.height * (1-self.grade);
CGFloat textWidth = self.bounds.size.width;
CGFloat textStartPosY;
if (startPosY < textheigt) {
textStartPosY = startPosY;
}
else {
textStartPosY = startPosY - textheigt;
}
[_chartLine addSublayer:self.textLayer];
[self.textLayer setFontSize:textheigt/2];
[self.textLayer setFontSize:18.0];
[self.textLayer setString:[[NSString alloc]initWithFormat:@"%0.f",grade*self.maxDivisor]];
CGSize size = CGSizeMake(320,2000); //设置一个行高上限
NSDictionary *attributes = @{NSFontAttributeName:[UIFont systemFontOfSize:18.0]};
size = [self.textLayer.string boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil].size;
float verticalY ;
if (size.height>=textheigt) {
verticalY = topSpace - size.height;
} else {
verticalY = topSpace + (textheigt-size.height)/2.0;
}
[self.textLayer setString:[[NSString alloc]initWithFormat:@"%0.f",grade*100]];
[self.textLayer setFrame:CGRectMake(0, textStartPosY, textWidth, textheigt)];
[self.textLayer setFrame:CGRectMake((textWidth-size.width)/2.0,verticalY, size.width,size.height)];
self.textLayer.contentsScale = [UIScreen mainScreen].scale;
}
- (void)setIsShowNumber:(BOOL)isShowNumber{
if (isShowNumber) {
self.textLayer.hidden = NO;
[self setGradeFrame:_copyGrade startPosY:0];
}else{
self.textLayer.hidden = YES;
}
}
- (void)setIsNegative:(BOOL)isNegative{
if (isNegative) {
[self.textLayer setString:[[NSString alloc]initWithFormat:@"- %1.f",_grade*self.maxDivisor]];
CGSize size = CGSizeMake(320,2000); //设置一个行高上限
NSDictionary *attributes = @{NSFontAttributeName:[UIFont systemFontOfSize:18.0]};
size = [self.textLayer.string boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil].size;
CGRect frame = self.textLayer.frame;
frame.origin.x = (self.bounds.size.width - size.width)/2.0;
frame.size = size;
self.textLayer.frame = frame;
CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI];
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
rotationAnimation.duration = 0.1;
rotationAnimation.repeatCount = 0;//你可以设置到最大的整数值
rotationAnimation.cumulative = NO;
rotationAnimation.removedOnCompletion = NO;
rotationAnimation.fillMode = kCAFillModeForwards;
[self.textLayer addAnimation:rotationAnimation forKey:@"Rotation"];
}
}
-(CABasicAnimation*)fadeAnimation
{
CABasicAnimation* fadeAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
... ...
... ... @@ -32,7 +32,7 @@ typedef NSString *(^PNYLabelFormatter)(CGFloat yLabelValue);
@property (nonatomic) NSMutableArray * bars;
@property (nonatomic) CGFloat xLabelWidth;
@property (nonatomic) int yValueMax;
@property (nonatomic) float yValueMax;
@property (nonatomic) UIColor *strokeColor;
@property (nonatomic) NSArray *strokeColors;
... ... @@ -54,9 +54,15 @@ typedef NSString *(^PNYLabelFormatter)(CGFloat yLabelValue);
/** Controls whether the chart border line should be displayed. */
@property (nonatomic) BOOL showChartBorder;
/** Controls whether the chart Horizontal separator should be displayed. */
@property (nonatomic, assign) BOOL showLevelLine;
/** Chart bottom border, co-linear with the x-axis. */
@property (nonatomic) CAShapeLayer * chartBottomLine;
/** Chart bottom border, level separator-linear with the x-axis. */
@property (nonatomic) CAShapeLayer * chartLevelLine;
/** Chart left border, co-linear with the y-axis. */
@property (nonatomic) CAShapeLayer * chartLeftLine;
... ... @@ -97,4 +103,10 @@ typedef NSString *(^PNYLabelFormatter)(CGFloat yLabelValue);
@property (nonatomic, weak) id<PNChartDelegate> delegate;
/**whether show gradient bar*/
@property (nonatomic, assign) BOOL isGradientShow;
/** whether show numbers*/
@property (nonatomic, assign) BOOL isShowNumbers;
@end
... ...
... ... @@ -56,12 +56,14 @@
_xLabelSkip = 1;
_yLabelSum = 4;
_labelMarginTop = 0;
_chartMargin = 15.0;
_chartMargin = 25.0;
_barRadius = 2.0;
_showChartBorder = NO;
_showLevelLine = NO;
_yChartLabelWidth = 18;
_rotateForXAxisText = false;
_isGradientShow = YES;
_isShowNumbers = YES;
_yLabelFormatter = ^(CGFloat yValue){
return [NSString stringWithFormat:@"%1.f",yValue];
};
... ... @@ -84,6 +86,7 @@
[self viewCleanupForCollection:_yChartLabels];
NSArray *yAxisValues = _yLabels ? _yLabels : _yValues;
_yLabelSum = _yLabels ? _yLabels.count - 1 :_yLabelSum;
if (_yMaxValue) {
_yValueMax = _yMaxValue;
} else {
... ... @@ -96,7 +99,7 @@
}
float sectionHeight = (self.frame.size.height - _chartMargin * 2 - kXLabelHeight) / _yLabelSum;
for (int i = 0; i < _yLabelSum; i++) {
for (int i = 0; i <= _yLabelSum; i++) {
NSString *labelText;
if (_yLabels) {
float yAsixValue = [_yLabels[_yLabels.count - i - 1] floatValue];
... ... @@ -117,8 +120,6 @@
}
}
-(void)updateChartData:(NSArray *)data{
self.yValues = data;
[self updateBar];
... ... @@ -126,10 +127,10 @@
- (void)getYValueMax:(NSArray *)yLabels
{
int max = [[yLabels valueForKeyPath:@"@max.intValue"] intValue];
CGFloat max = [[yLabels valueForKeyPath:@"@max.floatValue"] floatValue];
//ensure max is even
_yValueMax = max % 2 == 0 ? max : max + 1;
_yValueMax = max ;
if (_yValueMax == 0) {
_yValueMax = _yMinValue;
... ... @@ -219,25 +220,27 @@
}
bar = [[PNBar alloc] initWithFrame:CGRectMake(barXPosition, //Bar X position
self.frame.size.height - chartCavanHeight - kXLabelHeight - _chartMargin, //Bar Y position
self.frame.size.height - chartCavanHeight - kXLabelHeight - _chartMargin , //Bar Y position
barWidth, // Bar witdh
chartCavanHeight)]; //Bar height
self.showLevelLine ? chartCavanHeight/2.0:chartCavanHeight)]; //Bar height
//Change Bar Radius
bar.barRadius = _barRadius;
//Change Bar Background color
bar.backgroundColor = _barBackgroundColor;
//Bar StrokColor First
if (self.strokeColor) {
bar.barColor = self.strokeColor;
}else{
bar.barColor = [self barColorAtIndex:index];
}
// Add gradient
bar.barColorGradientStart = _barColorGradientStart;
if (self.isGradientShow) {
bar.barColorGradientStart = bar.barColor;
}
//For Click Index
bar.tag = index;
... ... @@ -247,15 +250,26 @@
//Height Of Bar
float value = [valueString floatValue];
float grade = (float)value / (float)_yValueMax;
float grade =fabsf((float)value / (float)_yValueMax);
if (isnan(grade)) {
grade = 0;
}
bar.maxDivisor = (float)_yValueMax;
bar.grade = grade;
bar.isShowNumber = self.isShowNumbers;
CGRect originalFrame = bar.frame;
NSString *currentNumber = [NSString stringWithFormat:@"%f",value];
if ([[currentNumber substringToIndex:1] isEqualToString:@"-"] && self.showLevelLine) {
CGAffineTransform transform =CGAffineTransformMakeRotation(M_PI);
[bar setTransform:transform];
originalFrame.origin.y = bar.frame.origin.y + bar.frame.size.height;
bar.frame = originalFrame;
bar.isNegative = YES;
index += 1;
}
index += 1;
}
}
... ... @@ -287,11 +301,8 @@
[progressline setLineWidth:1.0];
[progressline setLineCapStyle:kCGLineCapSquare];
_chartBottomLine.path = progressline.CGPath;
_chartBottomLine.strokeColor = PNLightGrey.CGColor;
CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
pathAnimation.duration = 0.5;
pathAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
... ... @@ -302,7 +313,7 @@
_chartBottomLine.strokeEnd = 1.0;
[self.layer addSublayer:_chartBottomLine];
//Add left Chart Line
_chartLeftLine = [CAShapeLayer layer];
... ... @@ -319,11 +330,8 @@
[progressLeftline setLineWidth:1.0];
[progressLeftline setLineCapStyle:kCGLineCapSquare];
_chartLeftLine.path = progressLeftline.CGPath;
_chartLeftLine.strokeColor = PNLightGrey.CGColor;
CABasicAnimation *pathLeftAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
pathLeftAnimation.duration = 0.5;
pathLeftAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
... ... @@ -335,9 +343,44 @@
[self.layer addSublayer:_chartLeftLine];
}
// Add Level Separator Line
if (_showLevelLine) {
_chartLevelLine = [CAShapeLayer layer];
_chartLevelLine.lineCap = kCALineCapButt;
_chartLevelLine.fillColor = [[UIColor whiteColor] CGColor];
_chartLevelLine.lineWidth = 1.0;
_chartLevelLine.strokeEnd = 0.0;
UIBezierPath *progressline = [UIBezierPath bezierPath];
[progressline moveToPoint:CGPointMake(_chartMargin, (self.frame.size.height - kXLabelHeight )/2.0)];
[progressline addLineToPoint:CGPointMake(self.frame.size.width - _chartMargin, (self.frame.size.height - kXLabelHeight )/2.0)];
[progressline setLineWidth:1.0];
[progressline setLineCapStyle:kCGLineCapSquare];
_chartLevelLine.path = progressline.CGPath;
_chartLevelLine.strokeColor = PNLightGrey.CGColor;
CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
pathAnimation.duration = 0.5;
pathAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
pathAnimation.fromValue = @0.0f;
pathAnimation.toValue = @1.0f;
[_chartLevelLine addAnimation:pathAnimation forKey:@"strokeEndAnimation"];
_chartLevelLine.strokeEnd = 1.0;
[self.layer addSublayer:_chartLevelLine];
} else {
if (_chartLevelLine) {
[_chartLevelLine removeFromSuperlayer];
_chartLevelLine = nil;
}
}
}
- (void)viewCleanupForCollection:(NSMutableArray *)array
{
if (array.count) {
... ... @@ -359,7 +402,6 @@
}
}
#pragma mark - Touch detection
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
... ... @@ -368,7 +410,6 @@
[super touchesBegan:touches withEvent:event];
}
- (void)touchPoint:(NSSet *)touches withEvent:(UIEvent *)event
{
//Get the point user touched
... ...
... ... @@ -1012,7 +1012,6 @@
-(void)setGradeFrame:(CATextLayer*)textLayer grade:(CGFloat)grade pointCenter:(CGPoint)pointCenter width:(CGFloat)width
{
return;
CGFloat textheigt = width*3;
CGFloat textWidth = width*4;
CGFloat textStartPosY;
... ...
... ... @@ -21,11 +21,10 @@
0AF7A880182AA9F6003645C4 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0AF7A87F182AA9F6003645C4 /* Images.xcassets */; };
0AF7A8AF182AAEEF003645C4 /* PCChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AF7A8AE182AAEEF003645C4 /* PCChartViewController.m */; };
5C728F7B8AACCC0864A63B26 /* libPods-PNChartTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B0A0D7DDAB496680487BF1E5 /* libPods-PNChartTests.a */; };
5C9B4AA31B05BBCB00093EBE /* PNBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C9B4AA21B05BBCB00093EBE /* PNBarChart.m */; };
6E984E5D1AE2B00600E817A0 /* PNBarChartTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E984E5C1AE2B00600E817A0 /* PNBarChartTests.m */; };
6E984E5E1AE2B03800E817A0 /* PNBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177EC9198DFAC400017E27 /* PNBar.m */; };
6E984E5F1AE2B03E00E817A0 /* PNBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ECB198DFAC400017E27 /* PNBarChart.m */; };
91177ED8198DFAC400017E27 /* PNBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177EC9198DFAC400017E27 /* PNBar.m */; };
91177EDA198DFAC400017E27 /* PNBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ECB198DFAC400017E27 /* PNBarChart.m */; };
91177EDC198DFAC400017E27 /* PNCircleChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ECD198DFAC400017E27 /* PNCircleChart.m */; };
91177EDE198DFAC400017E27 /* PNLineChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ECF198DFAC400017E27 /* PNLineChart.m */; };
91177EE0198DFAC400017E27 /* PNLineChartData.m in Sources */ = {isa = PBXBuildFile; fileRef = 91177ED1198DFAC400017E27 /* PNLineChartData.m */; };
... ... @@ -75,13 +74,13 @@
2980CA20C29DC029B2D0B926 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
3BA6321352024B1FBA0158B0 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
4D54B84CA1CAEB2BBBC9DCFA /* Pods-PNChartTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PNChartTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-PNChartTests/Pods-PNChartTests.release.xcconfig"; sourceTree = "<group>"; };
5C9B4AA21B05BBCB00093EBE /* PNBarChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNBarChart.m; sourceTree = "<group>"; };
6E984E511AE2AF2D00E817A0 /* PNChartTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PNChartTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
6E984E541AE2AF2D00E817A0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
6E984E5C1AE2B00600E817A0 /* PNBarChartTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNBarChartTests.m; sourceTree = "<group>"; };
91177EC8198DFAC400017E27 /* PNBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNBar.h; sourceTree = "<group>"; };
91177EC9198DFAC400017E27 /* PNBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNBar.m; sourceTree = "<group>"; };
91177ECA198DFAC400017E27 /* PNBarChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNBarChart.h; sourceTree = "<group>"; };
91177ECB198DFAC400017E27 /* PNBarChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNBarChart.m; sourceTree = "<group>"; };
91177ECC198DFAC400017E27 /* PNCircleChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNCircleChart.h; sourceTree = "<group>"; };
91177ECD198DFAC400017E27 /* PNCircleChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PNCircleChart.m; sourceTree = "<group>"; };
91177ECE198DFAC400017E27 /* PNLineChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PNLineChart.h; sourceTree = "<group>"; };
... ... @@ -249,7 +248,7 @@
91177EC8198DFAC400017E27 /* PNBar.h */,
91177EC9198DFAC400017E27 /* PNBar.m */,
91177ECA198DFAC400017E27 /* PNBarChart.h */,
91177ECB198DFAC400017E27 /* PNBarChart.m */,
5C9B4AA21B05BBCB00093EBE /* PNBarChart.m */,
91177ECC198DFAC400017E27 /* PNCircleChart.h */,
91177ECD198DFAC400017E27 /* PNCircleChart.m */,
91177ECE198DFAC400017E27 /* PNLineChart.h */,
... ... @@ -442,7 +441,6 @@
0AF7A8AF182AAEEF003645C4 /* PCChartViewController.m in Sources */,
0A29228A1A423FB300A42BC4 /* PNScatterChartDataItem.m in Sources */,
A9C75FA61A9F1DA900A54638 /* PNGenericChart.m in Sources */,
91177EDA198DFAC400017E27 /* PNBarChart.m in Sources */,
91177EE6198DFAC400017E27 /* PNPieChartDataItem.m in Sources */,
9FA23B10184A5944002DBBA4 /* PCChartsTableViewController.m in Sources */,
91177EE0198DFAC400017E27 /* PNLineChartData.m in Sources */,
... ... @@ -450,6 +448,7 @@
0AF7A874182AA9F6003645C4 /* main.m in Sources */,
91177EE4198DFAC400017E27 /* PNPieChart.m in Sources */,
0AF7A878182AA9F6003645C4 /* PCAppDelegate.m in Sources */,
5C9B4AA31B05BBCB00093EBE /* PNBarChart.m in Sources */,
0A2922891A423FB300A42BC4 /* PNScatterChartData.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
... ... @@ -458,7 +457,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6E984E5F1AE2B03E00E817A0 /* PNBarChart.m in Sources */,
6E984E5E1AE2B03800E817A0 /* PNBar.m in Sources */,
6E984E5D1AE2B00600E817A0 /* PNBarChartTests.m in Sources */,
);
... ...
... ... @@ -97,22 +97,17 @@
self.barChart.backgroundColor = [UIColor clearColor];
self.barChart.yLabelFormatter = ^(CGFloat yValue){
CGFloat yValueParsed = yValue;
NSString * labelText = [NSString stringWithFormat:@"%1.f",yValueParsed];
NSString * labelText = [NSString stringWithFormat:@"%0.f",yValueParsed];
return labelText;
};
self.barChart.labelMarginTop = 5.0;
[self.barChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]];
self.barChart.rotateForXAxisText = true ;
self.barChart.yLabelSum=5;
self.barChart.yMaxValue=100;
[self.barChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]];
// self.barChart.yLabels = @[@0,@20,@40,@60];
[self.barChart setStrokeColors:@[PNGreen,PNGreen,PNRed,PNGreen,PNGreen,PNYellow,PNGreen]];
// Adding gradient
self.barChart.barColorGradientStart = [UIColor blueColor];
self.barChart.showChartBorder = YES;
[self.barChart setXLabels:@[@"2",@"3",@"4",@"5"]];
// self.barChart.yLabels = @[@-10,@0,@10];
[self.barChart setYValues:@[@10.82,@1.88,@6.96,@33.93]];
[self.barChart setStrokeColors:@[PNGreen,PNGreen,PNRed,PNGreen]];
// self.barChart.isGradientShow = NO;
self.barChart.isShowNumbers = YES;
[self.barChart strokeChart];
self.barChart.delegate = self;
... ...
... ... @@ -10,4 +10,5 @@ SPEC CHECKSUMS:
Expecta: 78b4e8b0c8291fa4524d7f74016b6065c2e391ec
UICountingLabel: 1db4e7d023e1762171eb226d6dff47a7a84f27aa
COCOAPODS: 0.36.3
COCOAPODS: 0.37.1
... ...