Skip to content
This repository was archived by the owner on Dec 2, 2020. It is now read-only.

Commit aee4ad1

Browse files
committed
Merge pull request #87 from gavinbunney/master
Split enableReferenceAxisLines into two properties
2 parents c46ccb9 + 63a1d91 commit aee4ad1

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

Classes/BEMSimpleLineGraphView.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,14 @@
170170
@property (nonatomic) BOOL autoScaleYAxis;
171171

172172

173-
/// Draws a translucent vertical lines along the graph for each X-Axis label, when set to YES. Default value is NO.
174-
@property (nonatomic) BOOL enableReferenceAxisLines;
173+
/// Draws a translucent vertical lines along the graph for each X-Axis when set to YES. Default value is NO.
174+
@property (nonatomic) BOOL enableReferenceXAxisLines;
175+
176+
/// Draws a translucent horizontal lines along the graph for each Y-Axis label, when set to YES. Default value is NO.
177+
@property (nonatomic) BOOL enableReferenceYAxisLines;
175178

176179
/** Draws a translucent frame between the graph and any enabled axis, when set to YES. Default value is NO.
177-
@see enableReferenceAxisLines must be set to YES for this property to have any affect. */
180+
@see enableReferenceXAxisLines or enableReferenceYAxisLines must be set to YES for this property to have any affect. */
178181
@property (nonatomic) BOOL enableReferenceAxisFrame;
179182

180183

Classes/BEMSimpleLineGraphView.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,13 +437,12 @@ - (void)drawLine {
437437
} else {
438438
line.xAxisBackgroundColor = self.colorBackgroundXaxis;
439439
}
440-
if (self.enableReferenceAxisLines == YES) {
441-
if (self.enableReferenceAxisFrame) line.enableRefrenceFrame = YES;
442-
else line.enableRefrenceFrame = NO;
440+
if (self.enableReferenceXAxisLines || self.enableReferenceYAxisLines) {
441+
line.enableRefrenceFrame = self.enableReferenceAxisFrame;
443442

444443
line.enableRefrenceLines = YES;
445-
line.arrayOfVerticalRefrenceLinePoints = xAxisLabelPoints;
446-
line.arrayOfHorizontalRefrenceLinePoints = yAxisLabelPoints;
444+
line.arrayOfVerticalRefrenceLinePoints = self.enableReferenceXAxisLines ? xAxisLabelPoints : nil;
445+
line.arrayOfHorizontalRefrenceLinePoints = self.enableReferenceYAxisLines ? yAxisLabelPoints : nil;
447446
}
448447

449448
line.frameOffset = self.XAxisLabelYOffset;

Sample Project/SimpleLineChart/ViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ - (void)viewDidLoad {
5757
self.myGraph.enableYAxisLabel = YES;
5858
self.myGraph.autoScaleYAxis = YES;
5959
self.myGraph.alwaysDisplayDots = NO;
60-
self.myGraph.enableReferenceAxisLines = YES;
60+
self.myGraph.enableReferenceXAxisLines = YES;
61+
self.myGraph.enableReferenceYAxisLines = YES;
6162
self.myGraph.enableReferenceAxisFrame = YES;
6263
self.myGraph.animationGraphStyle = BEMLineAnimationDraw;
6364

0 commit comments

Comments
 (0)