Home

Awesome

MRBarView

A single bar chart for iOS

MRBarView

###Installation

Usage

MRBarView follows the usual data source pattern. You view controller should implement the protocol MRBarViewDataSource. The following methods are mandatory:

- (NSInteger)numberOfSegmentsInBarView:(MRBarView *)barView {
    return 5;
}
- (CGFloat)barView:(MRBarView *)barView valueAtIndex:(NSInteger)index {
    return 4.13;
}
- (UIColor *)barView:(MRBarView *)barView colorAtIndex:(NSInteger)index {
    return [UIColor redColor];
}

Optionally, you can return a label for each segment. Labels are shown below the bar.

- (NSString *)barView:(MRBarView *)barView labelAtIndex:(NSInteger)index {
    return @"Segment 1";
}

Notice that MRBarView will automatically calculate each segment's width in the bar by summing all the values provided by the datasource and calculating the proportion of each segment.

###Storyboards

In addition to using the bar view by doing [[MRBarView alloc] initWithFrame:...], if you are using storyboards you can simply drag a UIView into a view controller and set its class to MRBarView.

Customization

The following properties are customizable:

Reloading

To reload the bar view call reloadData:(BOOL)animated Check the sample project for documentation and usage options

To-Do