-
Notifications
You must be signed in to change notification settings - Fork 377
Feature Enhancement: Supply current popUp index parameter for lineGraph #256
base: master
Are you sure you want to change the base?
Changes from 4 commits
6777423
5524491
9614a06
ef2a725
fb434aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -449,13 +449,13 @@ IB_DESIGNABLE @interface BEMSimpleLineGraphView : UIView <UIGestureRecognizerDel | |
| /** The optional suffix to append to the popup report. | ||
| @param graph The graph object requesting the total number of points. | ||
| @return The suffix to append to the popup report. */ | ||
| - (NSString *)popUpSuffixForlineGraph:(BEMSimpleLineGraphView *)graph; | ||
| - (NSString *)popUpSuffixForlineGraph:(BEMSimpleLineGraphView *)graph index:(NSUInteger)index; | ||
|
|
||
|
|
||
| /** The optional prefix to append to the popup report. | ||
| @param graph The graph object requesting the total number of points. | ||
| @return The prefix to prepend to the popup report. */ | ||
| - (NSString *)popUpPrefixForlineGraph:(BEMSimpleLineGraphView *)graph; | ||
| - (NSString *)popUpPrefixForlineGraph:(BEMSimpleLineGraphView *)graph index:(NSUInteger)index; | ||
|
||
|
|
||
|
|
||
| /** Optional method to always display some of the pop up labels on the graph. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -136,6 +136,10 @@ - (instancetype)initWithCoder:(NSCoder *)coder { | |
| return self; | ||
| } | ||
|
|
||
| -(void)awakeFromNib{ | ||
|
||
| [self commonInit]; | ||
| } | ||
|
|
||
| - (void)commonInit { | ||
| // Do any initialization that's common to both -initWithFrame: and -initWithCoder: in this method | ||
|
|
||
|
|
@@ -360,11 +364,11 @@ - (void)layoutTouchReport { | |
|
|
||
| NSString *prefix = @""; | ||
| NSString *suffix = @""; | ||
| if ([self.delegate respondsToSelector:@selector(popUpSuffixForlineGraph:)]) { | ||
| suffix = [self.delegate popUpSuffixForlineGraph:self]; | ||
| if ([self.delegate respondsToSelector:@selector(popUpSuffixForlineGraph:index:)]) { | ||
| suffix = [self.delegate popUpSuffixForlineGraph:self index:0]; | ||
|
||
| } | ||
| if ([self.delegate respondsToSelector:@selector(popUpPrefixForlineGraph:)]) { | ||
| prefix = [self.delegate popUpPrefixForlineGraph:self]; | ||
| if ([self.delegate respondsToSelector:@selector(popUpPrefixForlineGraph:index:)]) { | ||
| prefix = [self.delegate popUpPrefixForlineGraph:self index:0]; | ||
|
||
| } | ||
|
|
||
| NSString *fullString = [NSString stringWithFormat:@"%@%@%@", prefix, longestString, suffix]; | ||
|
|
@@ -1089,13 +1093,14 @@ - (void)displayPermanentLabelForPoint:(BEMCircle *)circleDot { | |
| NSString *prefix = @""; | ||
| NSString *suffix = @""; | ||
|
|
||
| if ([self.delegate respondsToSelector:@selector(popUpSuffixForlineGraph:)]) | ||
| suffix = [self.delegate popUpSuffixForlineGraph:self]; | ||
| int index = (int)(circleDot.tag - DotFirstTag100); | ||
|
||
|
|
||
| if ([self.delegate respondsToSelector:@selector(popUpPrefixForlineGraph:)]) | ||
| prefix = [self.delegate popUpPrefixForlineGraph:self]; | ||
| if ([self.delegate respondsToSelector:@selector(popUpSuffixForlineGraph:index:)]) | ||
| suffix = [self.delegate popUpSuffixForlineGraph:self index:index]; | ||
|
|
||
| if ([self.delegate respondsToSelector:@selector(popUpPrefixForlineGraph:index:)]) | ||
| prefix = [self.delegate popUpPrefixForlineGraph:self index:index]; | ||
|
|
||
| int index = (int)(circleDot.tag - DotFirstTag100); | ||
| NSNumber *value = dataPoints[index]; // @((NSInteger) circleDot.absoluteValue) | ||
| NSString *formattedValue = [NSString stringWithFormat:self.formatStringForValues, value.doubleValue]; | ||
| permanentPopUpLabel.text = [NSString stringWithFormat:@"%@%@%@", prefix, formattedValue, suffix]; | ||
|
|
@@ -1391,8 +1396,8 @@ - (void)setUpPopUpLabelAbovePoint:(BEMCircle *)closestPoint { | |
|
|
||
| CGPoint popUpViewCenter = CGPointZero; | ||
|
|
||
| if ([self.delegate respondsToSelector:@selector(popUpSuffixForlineGraph:)]) | ||
| self.popUpLabel.text = [NSString stringWithFormat:@"%li%@", (long)[dataPoints[(NSInteger) closestDot.tag - DotFirstTag100] integerValue], [self.delegate popUpSuffixForlineGraph:self]]; | ||
| if ([self.delegate respondsToSelector:@selector(popUpSuffixForlineGraph:index:)]) | ||
| self.popUpLabel.text = [NSString stringWithFormat:@"%li%@", (long)[dataPoints[(NSInteger) closestDot.tag - DotFirstTag100] integerValue], [self.delegate popUpSuffixForlineGraph:self index:index]]; | ||
| else | ||
| self.popUpLabel.text = [NSString stringWithFormat:@"%li", (long)[dataPoints[(NSInteger) closestDot.tag - DotFirstTag100] integerValue]]; | ||
|
|
||
|
|
@@ -1426,11 +1431,11 @@ - (void)setUpPopUpLabelAbovePoint:(BEMCircle *)closestPoint { | |
| } completion:nil]; | ||
| NSString *prefix = @""; | ||
| NSString *suffix = @""; | ||
| if ([self.delegate respondsToSelector:@selector(popUpSuffixForlineGraph:)]) { | ||
| suffix = [self.delegate popUpSuffixForlineGraph:self]; | ||
| if ([self.delegate respondsToSelector:@selector(popUpSuffixForlineGraph:index:)]) { | ||
| suffix = [self.delegate popUpSuffixForlineGraph:self index:index]; | ||
| } | ||
| if ([self.delegate respondsToSelector:@selector(popUpPrefixForlineGraph:)]) { | ||
| prefix = [self.delegate popUpPrefixForlineGraph:self]; | ||
| if ([self.delegate respondsToSelector:@selector(popUpPrefixForlineGraph:index:)]) { | ||
| prefix = [self.delegate popUpPrefixForlineGraph:self index:index]; | ||
| } | ||
| NSNumber *value = dataPoints[index]; | ||
| NSString *formattedValue = [NSString stringWithFormat:self.formatStringForValues, value.doubleValue]; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -240,7 +240,7 @@ - (void)lineGraphDidFinishLoading:(BEMSimpleLineGraphView *)graph { | |
| // Use this method for tasks after the graph has finished drawing | ||
| } */ | ||
|
|
||
| - (NSString *)popUpSuffixForlineGraph:(BEMSimpleLineGraphView *)graph { | ||
| - (NSString *)popUpSuffixForlineGraph:(BEMSimpleLineGraphView *)graph index:(NSUInteger)index{ | ||
| return @" people"; | ||
| } | ||
|
|
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The commented out method on line 247 also needs to be updated with the new parameter |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename the method to
- (NSString *)popUpSuffixForlineGraph:(BEMSimpleLineGraphView *)graph atIndex:(NSUInteger)index;.The comment also needs to be updated.