-
Notifications
You must be signed in to change notification settings - Fork 382
Axis Labels
BEMSimpleLineGraph offers an easy way to include labels along the graph's axis.
##X-Axis To add labels along the X-Axis, simply implement the two followings methods: `numberOfGapsBetweenLabelsOnLineGraph:` and `lineGraph:labelOnXAxisForIndex:`.Gaps between labels
Informs how much empty space is needed between each displayed label. Returning 0 will display all of the labels. Returning the total number of labels will only display the first and last label. See the image below for clarification.
- (NSInteger)numberOfGapsBetweenLabelsOnLineGraph:(BEMSimpleLineGraphView *)graph {
return X; // The number of hidden labels between each displayed label.
}
On the left, numberOfGapsBetweenLabelsOnLineGraph: returns 0, in the middle it returns 1 and on the right it returns the number of points in the graph.
Label on X Axis
The text to be displayed for each UILabel on the X-Axis at a given index. It should return as many strings as the number of points on the graph.
- (NSString *)lineGraph:(BEMSimpleLineGraphView *)graph labelOnXAxisForIndex:(NSInteger)index {
return …;
}
X-Axis Label Color
The property colorXaxisLabel
controls the color of the text of the UILabels on the X-Axis:
@property (strong, nonatomic) UIColor *colorXaxisLabel;