Skip to content

Commit

Permalink
able to customize text on no data label
Browse files Browse the repository at this point in the history
  • Loading branch information
sbhhbs committed Nov 5, 2014
1 parent 63bab0d commit fe98eb8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Classes/BEMSimpleLineGraphView.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@
@return The boolean value indicating the availability of the NO DATA label. */
- (BOOL)noDataLabelEnableForLineGraph:(BEMSimpleLineGraphView *)graph;

/** Optional method to control the text to be displayed on NO DATA label
@param graph The graph object for the NO DATA label
@return The text to show on the NO DATA label. */
- (NSString *)noDataLabelTextForLineGraph:(BEMSimpleLineGraphView *)graph;

/** Optional method to set the static padding distance between the graph line and the whole graph
@param graph The graph object requesting the padding value.
@return The padding value of the graph. */
Expand Down
7 changes: 6 additions & 1 deletion Classes/BEMSimpleLineGraphView.m
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,12 @@ - (void)layoutNumberOfPoints {
self.noDataLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.viewForBaselineLayout.frame.size.width, self.viewForBaselineLayout.frame.size.height)];
self.noDataLabel.backgroundColor = [UIColor clearColor];
self.noDataLabel.textAlignment = NSTextAlignmentCenter;
self.noDataLabel.text = @"No Data";
NSString *noDataText;
if ([self.delegate respondsToSelector:@selector(noDataLabelTextForLineGraph:)])
{
noDataText = [self.delegate noDataLabelTextForLineGraph:self];
}
self.noDataLabel.text = noDataText ?: NSLocalizedString(@"No Data", nil);
self.noDataLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:15];
self.noDataLabel.textColor = self.colorLine;
[self.viewForBaselineLayout addSubview:self.noDataLabel];
Expand Down

0 comments on commit fe98eb8

Please sign in to comment.