Skip to content
forked from kevinzhow/PNChart

A simple and beautiful chart lib used in Piner for iOS

License

Notifications You must be signed in to change notification settings

isneyl16/PNChart

 
 

Repository files navigation

#PNChart

A simple and beautiful chart lib with animation used in Piner for iOS

Requirements

PNChart works on iOS 6.0 and later version and is compatible with ARC projects. It depends on the following Apple frameworks, which should already be included with most Xcode templates:

  • Foundation.framework
  • UIKit.framework
  • CoreGraphics.framework
  • QuartzCore.framework

You will need LLVM 3.0 or later in order to build PNChart.

Usage

Cocoapods

CocoaPods is the recommended way to add PNChart to your project.

  1. Add a pod entry for PNChart to your Podfile pod 'PNChart', '~> 0.2.2'
  2. Install the pod(s) by running pod install.
  3. Include PNChart wherever you need it with #import "PNChart.h".

Copy the PNChart folder to your project

Line Chart

  #import "PNChart.h"

  //For LineChart
  PNChart * lineChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)];
  [lineChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5"]];
  [lineChart setYValues:@[@1, @10, @2, @6, @3]];
  [lineChart strokeChart];

  #import "PNChart.h"

  //For BarChart
  PNChart * barChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)];
  barChart.type = PNBarType;
  [barChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5"]];
  [barChart setYValues:@[@1,  @10, @2, @6, @3]];
  [barChart strokeChart];

  #import "PNChart.h"

  //For CircleChart

  PNChart * circleChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)];
  circleChart.type = PNCircleType;
  circleChart.total = [NSNumber numberWithInt:100];
  circleChart.current = [NSNumber numberWithInt:60];
  [circleChart strokeChart];

License

This code is distributed under the terms and conditions of the MIT license.

SpecialThanks

@lexrus CocoaPods Spec

About

A simple and beautiful chart lib used in Piner for iOS

Resources

License

Stars

Watchers

Forks

Packages

No packages published