Skip to content

michalkonturek/GraphKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

3fdc687 · Jan 21, 2017
Sep 29, 2014
Apr 15, 2015
Apr 27, 2014
Feb 4, 2014
Aug 13, 2014
Apr 27, 2014
Jul 3, 2014

Repository files navigation

GraphKit

License MIT License MIT CocoaPods

A lightweight library of animated charts for iOS.

License

Source code of this project is available under the standard MIT license. Please see the license file.

Usage

To see a quick demo, simply type pod try GraphKit.

Bar Graph

Build Platform

Initialize GKBarGraph from nib or programmatically:

CGRect frame = CGRectMake(0, 40, 320, 200);
self.graphView = [[GKBarGraph alloc] initWithFrame:frame];

then set GKGraphViewDataSource

self.graphView.dataSource = self;

and call draw method.

[self.graphView draw];

Please see example.

GKBarGraphDataSource Protocol

@required
- (NSInteger)numberOfBars;
- (NSNumber *)valueForBarAtIndex:(NSInteger)index;

@optional
- (UIColor *)colorForBarAtIndex:(NSInteger)index;
- (UIColor *)colorForBarBackgroundAtIndex:(NSInteger)index;
- (CFTimeInterval)animationDurationForBarAtIndex:(NSInteger)index;
- (NSString *)titleForBarAtIndex:(NSInteger)index;

Line Graph

Build Platform

CGRect frame = CGRectMake(0, 40, 320, 200);
self.graphView = [[GKLineGraph alloc] initWithFrame:frame];

self.graph.dataSource = self;
self.graph.lineWidth = 3.0;

[self.graph draw];

Please see example.

GKLineGraphDataSource Protocol

@required
- (NSInteger)numberOfLines;
- (UIColor *)colorForLineAtIndex:(NSInteger)index;
- (NSArray *)valuesForLineAtIndex:(NSInteger)index;

@optional
- (CFTimeInterval)animationDurationForLineAtIndex:(NSInteger)index;
- (NSString *)titleForLineAtIndex:(NSInteger)index;

Contributing

  1. Fork it.
  2. Create your feature branch (git checkout -b new-feature).
  3. Commit your changes (git commit -am 'Added new-feature').
  4. Push to the branch (git push origin new-feature).
  5. Create new Pull Request.