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

Commit

Permalink
Split enableReferenceAxisLines into two properties
Browse files Browse the repository at this point in the history
Allow individual specifying of just X, Y or both reference lines
  • Loading branch information
Gavin Bunney committed Nov 2, 2014
1 parent c46ccb9 commit 63a1d91
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
9 changes: 6 additions & 3 deletions Classes/BEMSimpleLineGraphView.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,14 @@
@property (nonatomic) BOOL autoScaleYAxis;


/// Draws a translucent vertical lines along the graph for each X-Axis label, when set to YES. Default value is NO.
@property (nonatomic) BOOL enableReferenceAxisLines;
/// Draws a translucent vertical lines along the graph for each X-Axis when set to YES. Default value is NO.
@property (nonatomic) BOOL enableReferenceXAxisLines;

/// Draws a translucent horizontal lines along the graph for each Y-Axis label, when set to YES. Default value is NO.
@property (nonatomic) BOOL enableReferenceYAxisLines;

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


Expand Down
9 changes: 4 additions & 5 deletions Classes/BEMSimpleLineGraphView.m
Original file line number Diff line number Diff line change
Expand Up @@ -437,13 +437,12 @@ - (void)drawLine {
} else {
line.xAxisBackgroundColor = self.colorBackgroundXaxis;
}
if (self.enableReferenceAxisLines == YES) {
if (self.enableReferenceAxisFrame) line.enableRefrenceFrame = YES;
else line.enableRefrenceFrame = NO;
if (self.enableReferenceXAxisLines || self.enableReferenceYAxisLines) {
line.enableRefrenceFrame = self.enableReferenceAxisFrame;

line.enableRefrenceLines = YES;
line.arrayOfVerticalRefrenceLinePoints = xAxisLabelPoints;
line.arrayOfHorizontalRefrenceLinePoints = yAxisLabelPoints;
line.arrayOfVerticalRefrenceLinePoints = self.enableReferenceXAxisLines ? xAxisLabelPoints : nil;
line.arrayOfHorizontalRefrenceLinePoints = self.enableReferenceYAxisLines ? yAxisLabelPoints : nil;
}

line.frameOffset = self.XAxisLabelYOffset;
Expand Down
3 changes: 2 additions & 1 deletion Sample Project/SimpleLineChart/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ - (void)viewDidLoad {
self.myGraph.enableYAxisLabel = YES;
self.myGraph.autoScaleYAxis = YES;
self.myGraph.alwaysDisplayDots = NO;
self.myGraph.enableReferenceAxisLines = YES;
self.myGraph.enableReferenceXAxisLines = YES;
self.myGraph.enableReferenceYAxisLines = YES;
self.myGraph.enableReferenceAxisFrame = YES;
self.myGraph.animationGraphStyle = BEMLineAnimationDraw;

Expand Down

0 comments on commit 63a1d91

Please sign in to comment.