Latest 0.1.1
Homepage https://github.com/matthewcheok/MCGraphView
License MIT
Platforms ios 6.0, requires ARC
Authors

MCGraphView License MIT

Badge w/ Version
Badge w/ Platform

A light-weight solution for displaying graphs.

Screenshot

Screenshot

Installation

Add the following to your CocoaPods Podfile

pod 'MCGraphView', '~> 0.1'

or clone as a git submodule,

or just copy files in the MCGraphView folder into your project.

Using MCGraphView

Add the MCGraphView class either programmatically or assign the custom class via storyboard. Then set the lineData property:

self.graphView.lineData = @[
  @[
    [NSValue valueWithCGPoint:CGPointMake(1, 20)],
    [NSValue valueWithCGPoint:CGPointMake(2, 40)],
    [NSValue valueWithCGPoint:CGPointMake(3, 20)],
    [NSValue valueWithCGPoint:CGPointMake(4, 60)],
    [NSValue valueWithCGPoint:CGPointMake(5, 40)],
    [NSValue valueWithCGPoint:CGPointMake(6, 140)],
    [NSValue valueWithCGPoint:CGPointMake(7, 80)],
  ],
  @[
    [NSValue valueWithCGPoint:CGPointMake(1, 40)],
    [NSValue valueWithCGPoint:CGPointMake(2, 20)],
    [NSValue valueWithCGPoint:CGPointMake(3, 60)],
    [NSValue valueWithCGPoint:CGPointMake(4, 100)],
    [NSValue valueWithCGPoint:CGPointMake(5, 60)],
    [NSValue valueWithCGPoint:CGPointMake(6, 20)],
    [NSValue valueWithCGPoint:CGPointMake(7, 60)],
  ]
];

Then tell the view to reload data:

[self.graphView reloadDataAnimated:YES];

The view automatically determines the ideal region to display based on the maximum and minimum values of your points.

More configuration options are available via the delegate protocol MCGraphViewDelegate. See the demo project for details.

Credits

Inspired by GraphKit and BEMSimpleLineGraph.

License

MCGraphView is under the MIT license.

Latest podspec

{
    "name": "MCGraphView",
    "version": "0.1.1",
    "platforms": {
        "ios": "6.0"
    },
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "summary": "A light-weight solution for displaying graphs.",
    "homepage": "https://github.com/matthewcheok/MCGraphView",
    "authors": {
        "Matthew Cheok": "[email protected]"
    },
    "requires_arc": true,
    "source": {
        "git": "https://github.com/matthewcheok/MCGraphView.git",
        "branch": "master",
        "tag": "0.1.1"
    },
    "source_files": "MCGraphView/*.{h,m}",
    "public_header_files": "MCGraphView/*.h"
}

Pin It on Pinterest

Share This