Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified ZFChartView/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ - (void)viewDidLoad{
self.waveChart.dataSource = self;
self.waveChart.delegate = self;
self.waveChart.topicLabel.text = @"xx小学各年级人数";
self.waveChart.wavePatternType = kWavePatternTypeSharp;
self.waveChart.isVerticalClose = YES;
self.waveChart.unit = @"人";
// self.waveChart.isShowYLineSeparate = YES;
// self.waveChart.pathColor = ZFGrassGreen;
Expand Down
3 changes: 3 additions & 0 deletions ZFChartView/ZFChartView/ZFChart/ZFGenericChart/ZFGenericChart.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@
/** 是否显示坐标轴箭头(默认为YES) */
@property (nonatomic, assign) BOOL isShowAxisArrows;

/** 最后一个关闭区域是否垂直关闭 */
@property (nonatomic, assign) BOOL isVerticalClose;



#pragma mark - 此方法不需理会(Ignore this method)
Expand Down
5 changes: 5 additions & 0 deletions ZFChartView/ZFChartView/ZFChart/ZFWaveChart/ZFWave.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,16 @@ typedef enum{
/** 是否带动画显示(默认为YES,带动画) */
@property (nonatomic, assign) BOOL isAnimated;

/** 最后一个关闭区域是否垂直关闭 Riber添加 适用于kWavePatternTypeSharp样式*/
@property (nonatomic, assign) BOOL isVerticalClose;

#pragma mark - public method

/**
* 重绘
*/
- (void)strokePath;



@end
26 changes: 23 additions & 3 deletions ZFChartView/ZFChartView/ZFChart/ZFWaveChart/ZFWave.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,22 @@ - (UIBezierPath *)fill{
[subBezier addLineToPoint:CGPointMake([currentPoint[ZFWaveChartXPos] floatValue], [currentPoint[ZFWaveChartYPos] floatValue])];
}
}

//判断绘画直线还是曲线
subBezier = attribute.isCurve ? [subBezier smoothedPathWithGranularity:_padding] : subBezier;
[bezier appendPath:subBezier];

UIBezierPath * closeBezier = [UIBezierPath bezierPath];
[closeBezier moveToPoint:CGPointMake(self.frame.size.width, self.frame.size.height)];

if (_isVerticalClose) {
NSDictionary * lastPoint = [attribute.pointArray lastObject];
[closeBezier moveToPoint:CGPointMake([lastPoint[ZFWaveChartXPos] floatValue], self.frame.size.height)];
}
else
{
[closeBezier moveToPoint:CGPointMake(self.frame.size.width, self.frame.size.height)];
}

[closeBezier addLineToPoint:CGPointMake(0, self.frame.size.height)];
[bezier appendPath:closeBezier];
}
Expand All @@ -118,8 +128,18 @@ - (UIBezierPath *)fill{
NSDictionary * point = _valuePointArray[i];
[bezier addLineToPoint:CGPointMake([point[ZFWaveChartXPos] floatValue], [point[ZFWaveChartYPos] floatValue])];
}

[bezier addLineToPoint:CGPointMake(self.frame.size.width, self.frame.size.height)];

if (_isVerticalClose) {
NSDictionary * lastPoint = [_valuePointArray lastObject];
[bezier addLineToPoint:CGPointMake([lastPoint[ZFWaveChartXPos] floatValue], self.frame.size.height)];
}
else
{
[bezier addLineToPoint:CGPointMake(self.frame.size.width, self.frame.size.height)];
}



[bezier closePath];
return bezier;
}
Expand Down
1 change: 1 addition & 0 deletions ZFChartView/ZFChartView/ZFChart/ZFWaveChart/ZFWaveChart.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ - (void)drawWavePath{
self.wave.padding = self.genericAxis.groupPadding;
self.wave.wavePatternType = _wavePatternType;
self.wave.isAnimated = self.isAnimated;
self.wave.isVerticalClose = self.isVerticalClose;
self.wave.opacity = self.opacity;
self.wave.gradientAttribute = _gradientAttribute;
[self.genericAxis addSubview:self.wave];
Expand Down