Skip to content

Commit 7a712df

Browse files
committed
PR Boris-Em#295 fixes
Spacing consistency with rest of project topline fix Move UIButton+switch and UITextField+Numbers from Master to separate files Title of Master "Options" Add Graph button if collapsed
1 parent d416969 commit 7a712df

15 files changed

+255
-183
lines changed

Classes/BEMAverageLine.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ - (instancetype)init {
2222
return self;
2323
}
2424

25-
- (instancetype) initWithCoder:(NSCoder *)coder {
25+
- (instancetype)initWithCoder:(NSCoder *)coder {
2626

2727
#define RestoreProperty(property, type) {\
2828
if ([coder containsValueForKey:@#property]) { \
@@ -46,7 +46,7 @@ - (instancetype) initWithCoder:(NSCoder *)coder {
4646
return self;
4747
}
4848

49-
- (void) encodeWithCoder: (NSCoder *)coder {
49+
- (void)encodeWithCoder:(NSCoder *)coder {
5050

5151
#define EncodeProperty(property, type) [coder encode ## type: self.property forKey:@#property]
5252
EncodeProperty (enableAverageLine, Bool);
@@ -60,14 +60,14 @@ - (void) encodeWithCoder: (NSCoder *)coder {
6060

6161

6262

63-
-(void) setLabel:(UILabel *)label {
63+
- (void)setLabel:(UILabel *)label {
6464
if (_label != label) {
6565
[_label removeFromSuperview];
6666
_label = label;
6767
}
6868
}
6969

70-
-(void) dealloc {
70+
- (void)dealloc {
7171
self.label= nil;
7272
}
7373
@end

Classes/BEMLine.m

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -48,30 +48,29 @@ - (void)drawRect:(CGRect)rect {
4848
referenceFramePath.lineCapStyle = kCGLineCapButt;
4949
referenceFramePath.lineWidth = 0.7f;
5050

51-
if (self.enableReferenceFrame == YES) {
52-
if (self.enableBottomReferenceFrameLine) {
53-
// Bottom Line
54-
[referenceFramePath moveToPoint:CGPointMake(0, self.frame.size.height-self.referenceLineWidth/4)];
55-
[referenceFramePath addLineToPoint:CGPointMake(self.frame.size.width, self.frame.size.height-self.referenceLineWidth/4)];
56-
}
51+
CGFloat offset = self.referenceLineWidth/4; //moves framing ref line slightly into view
52+
if (self.enableBottomReferenceFrameLine) {
53+
// Bottom Line
54+
[referenceFramePath moveToPoint: CGPointMake(0, self.frame.size.height-offset)];
55+
[referenceFramePath addLineToPoint:CGPointMake(self.frame.size.width, self.frame.size.height-offset)];
56+
}
5757

58-
if (self.enableLeftReferenceFrameLine) {
59-
// Left Line
60-
[referenceFramePath moveToPoint:CGPointMake(0+self.referenceLineWidth/4, self.frame.size.height)];
61-
[referenceFramePath addLineToPoint:CGPointMake(0+self.referenceLineWidth/4, 0)];
62-
}
58+
if (self.enableLeftReferenceFrameLine) {
59+
// Left Line
60+
[referenceFramePath moveToPoint: CGPointMake(0+offset, self.frame.size.height)];
61+
[referenceFramePath addLineToPoint:CGPointMake(0+offset, 0)];
62+
}
6363

64-
if (self.enableTopReferenceFrameLine) {
65-
// Top Line
66-
[referenceFramePath moveToPoint:CGPointMake(0+self.referenceLineWidth/4, self.referenceLineWidth/4)];
67-
[referenceFramePath addLineToPoint:CGPointMake(self.frame.size.width, self.referenceLineWidth/4)];
68-
}
64+
if (self.enableTopReferenceFrameLine) {
65+
// Top Line
66+
[referenceFramePath moveToPoint: CGPointMake(0, offset)];
67+
[referenceFramePath addLineToPoint:CGPointMake(self.frame.size.width, offset)];
68+
}
6969

70-
if (self.enableRightReferenceFrameLine) {
71-
// Right Line
72-
[referenceFramePath moveToPoint:CGPointMake(self.frame.size.width - self.referenceLineWidth/4, self.frame.size.height)];
73-
[referenceFramePath addLineToPoint:CGPointMake(self.frame.size.width - self.referenceLineWidth/4, 0)];
74-
}
70+
if (self.enableRightReferenceFrameLine) {
71+
// Right Line
72+
[referenceFramePath moveToPoint: CGPointMake(self.frame.size.width - offset, self.frame.size.height)];
73+
[referenceFramePath addLineToPoint:CGPointMake(self.frame.size.width - offset, 0)];
7574
}
7675

7776
if (self.enableReferenceLines == YES) {
@@ -309,7 +308,7 @@ - (void)drawRect:(CGRect)rect {
309308
}
310309
}
311310

312-
- (NSArray <NSValue *> *) areaArrayFromArray: (NSArray <NSValue *> *) array withEdgeAt:(CGFloat) edgeHeight {
311+
- (NSArray <NSValue *> *)areaArrayFromArray:(NSArray <NSValue *> *)array withEdgeAt:(CGFloat)edgeHeight {
313312
CGFloat halfHeight = self.frame.size.height/2;
314313
CGPoint midLeftPoint = CGPointMake(0, halfHeight);
315314
CGPoint midRightPoint = CGPointMake(self.frame.size.width,halfHeight);
@@ -328,11 +327,11 @@ - (void)drawRect:(CGRect)rect {
328327
return areaPoints;
329328
}
330329

331-
- (NSArray <NSValue *> *)topPointsFromArray: (NSArray <NSValue *> *) array {
330+
- (NSArray <NSValue *> *)topPointsFromArray:(NSArray <NSValue *> *)array {
332331
return [self areaArrayFromArray: array withEdgeAt:0];
333332
}
334333

335-
- (NSArray <NSValue *> *)bottomPointsFromArray: (NSArray <NSValue *> *) array {
334+
- (NSArray <NSValue *> *)bottomPointsFromArray:(NSArray <NSValue *> *)array {
336335
return [self areaArrayFromArray: array withEdgeAt:self.frame.size.height];
337336
}
338337

Classes/BEMSimpleLineGraphView.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ IB_DESIGNABLE @interface BEMSimpleLineGraphView : UIView <UIGestureRecognizerDel
7272
/** Allows a higher-resolution snapshot of the graph while the app is in the foreground.
7373
@param size in pixels for your image.
7474
@return The snapshot of the graph as a UIImage object. */
75-
- (UIImage *)graphSnapshotImage: (CGSize) size NS_AVAILABLE_IOS(7_0);
75+
- (UIImage *)graphSnapshotImage:(CGSize)size NS_AVAILABLE_IOS(7_0);
7676

7777

7878
/** Takes a snapshot of the graph.
@@ -639,7 +639,7 @@ IB_DESIGNABLE @interface BEMSimpleLineGraphView : UIView <UIGestureRecognizerDel
639639
@param displayMinXValue The smallest datapoint that will be included in the chart (either index or value, depending on whether locationForPointAtIndex is implemented).
640640
@param displayMaxXValue The largest datapoint that will be included in the chart.
641641
@return YES if pan/zoom is ok; No if pan/zoom is prevented. */
642-
-(BOOL) lineGraph:(BEMSimpleLineGraphView *)graph shouldScaleFrom:(CGFloat)oldScale to:(CGFloat)newScale showingFromXMinValue:(CGFloat)displayMinXValue toXMaxValue:(CGFloat)displayMaxXValue;
642+
- (BOOL)lineGraph:(BEMSimpleLineGraphView *)graph shouldScaleFrom:(CGFloat)oldScale to:(CGFloat)newScale showingFromXMinValue:(CGFloat)displayMinXValue toXMaxValue:(CGFloat)displayMaxXValue;
643643

644644
//----- Y AXIS -----//
645645

@@ -663,17 +663,19 @@ IB_DESIGNABLE @interface BEMSimpleLineGraphView : UIView <UIGestureRecognizerDel
663663
- (NSString *)yAxisSuffixOnLineGraph:(BEMSimpleLineGraphView *)graph;
664664

665665

666-
/** Starting value to begin drawing Y-Axis labels MUST ALSO IMPLEMENT incrementValueForYAxisOnLineGraph FOR THIS TO TAKE EFFECT
667-
@discussion This allows you to finally hone the granularity of the data label. Instead of drawing values like 11.24,
666+
/** Starting value to begin drawing Y-Axis labels
667+
MUST ALSO IMPLEMENT incrementValueForYAxisOnLineGraph FOR THIS TO TAKE EFFECT
668+
@discussion This allows you to finely hone the granularity of the data label. Instead of drawing values like 11.24,
668669
you can lock these values to draw 11.20 to make it more user friendly. When this is set, `numberOfYAxisLabelsOnLineGraph` is ignored.
669670
@param graph The graph object which is requesting the number of gaps between the labels.
670671
@return The base value to draw the first Y-Axis label */
671672
- (CGFloat)baseValueForYAxisOnLineGraph:(BEMSimpleLineGraphView *)graph;
672673

673674

674-
/** Increment value to apply to the base Y-Axis label. MUST ALSO IMPLEMENT baseValueForYAxisOnLineGraph FOR THIS TO TAKE EFFECT
675+
/** Increment value to apply to the base Y-Axis label.
676+
MUST ALSO IMPLEMENT baseValueForYAxisOnLineGraph FOR THIS TO TAKE EFFECT
675677
@discussion This value tells the graph the interval to be applied to the base Y-Axis value. This allows you to increment the Y-Axis via user-friendly values rather than values
676-
like 37.17. This let's you enforce that your Y-Axis have values rounded to whatever granularity best fits your data.
678+
like 37.17. This lets you enforce that your Y-Axis have values rounded to whatever granularity best fits your data.
677679
@param graph The graph object which is requesting the number of gaps between the labels.
678680
@return The increment value to add to the value returned from `baseValueForYAxisOnLineGraph` for future Y-Axis labels */
679681
- (CGFloat)incrementValueForYAxisOnLineGraph:(BEMSimpleLineGraphView *)graph;

0 commit comments

Comments
 (0)