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

Commit fe98eb8

Browse files
committed
able to customize text on no data label
1 parent 63bab0d commit fe98eb8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Classes/BEMSimpleLineGraphView.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,11 @@
362362
@return The boolean value indicating the availability of the NO DATA label. */
363363
- (BOOL)noDataLabelEnableForLineGraph:(BEMSimpleLineGraphView *)graph;
364364

365+
/** Optional method to control the text to be displayed on NO DATA label
366+
@param graph The graph object for the NO DATA label
367+
@return The text to show on the NO DATA label. */
368+
- (NSString *)noDataLabelTextForLineGraph:(BEMSimpleLineGraphView *)graph;
369+
365370
/** Optional method to set the static padding distance between the graph line and the whole graph
366371
@param graph The graph object requesting the padding value.
367372
@return The padding value of the graph. */

Classes/BEMSimpleLineGraphView.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,12 @@ - (void)layoutNumberOfPoints {
212212
self.noDataLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.viewForBaselineLayout.frame.size.width, self.viewForBaselineLayout.frame.size.height)];
213213
self.noDataLabel.backgroundColor = [UIColor clearColor];
214214
self.noDataLabel.textAlignment = NSTextAlignmentCenter;
215-
self.noDataLabel.text = @"No Data";
215+
NSString *noDataText;
216+
if ([self.delegate respondsToSelector:@selector(noDataLabelTextForLineGraph:)])
217+
{
218+
noDataText = [self.delegate noDataLabelTextForLineGraph:self];
219+
}
220+
self.noDataLabel.text = noDataText ?: NSLocalizedString(@"No Data", nil);
216221
self.noDataLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:15];
217222
self.noDataLabel.textColor = self.colorLine;
218223
[self.viewForBaselineLayout addSubview:self.noDataLabel];

0 commit comments

Comments
 (0)