一个简单、漂亮的 iOS 图表库:PNChart

jopen 10年前

简单带有动画效果的图表库,在iOS应用中Piner中使用。


需要
PNChart支持iOS6.0以上系统,使用ARC。使用需要安装以下框架:
Foundation
UIKit
CoreGraphics
QuartzCore


用法

复制PNChart文件夹到工程中
#import "PNChart.h"       //For LineChart    PNChart * lineChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 75.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];       //For BarChart    PNChart * barChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 75.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];       //By strokeColor you can change the chart color    [barChart setStrokeColor:PN推terColor];

项目主页:http://www.open-open.com/lib/view/home/1387101390687