文章来源:淘论文网   发布者: 毕业设计   浏览量: 38



还可以点击去查询以下关键词:
[自定义]    [图定]    [制表]    [PNChart]    [iOS可自定义图定制表库 - PNChart]   

项目介绍:

项目简介

PNChart是一个简单优美的图表库,支持 Piner 和 CoinsMan 的iOS动画。

使用方法Cocoapods

推荐使用 CocoaPods 去添加PNChart到你的项目。

1.在你的Podfile中为PNChart添加一个pod记录 pod 'PNChart'

2.运行 pod install 安装pod

3.在你需要使用PNCh art的地方 #import "PNChart.h"

讲PNChart文件夹添加到你的项目中

import "PNChart.h"

//For Line Chart
PNLineChart * lineChart = [[PNLineChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)];
[lineChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5"]];

// Line Chart No.1
NSArray * data01Array = @[@60.1, @160.1, @126.4, @262.2, @186.2];
PNLineChartData *data01 = [PNLineChartData new];
data01.color = PNFreshGreen;
data01.itemCount = lineChart.xLabels.count;
data01.getData = ^(NSUInteger index) {

CGFloat yValue = [data01Array[index] floatValue]; return [PNLineChartDataItem dataItemWithY:yValue];

};
// Line Chart No.2
NSArray * data02Array = @[@20.1, @180.1, @26.4, @202.2, @126.2];
PNLineChartData *data02 = [PNLineChartData new];
data02.color = PNTwitterColor;
data02.itemCount = lineChart.xLabels.count;
data02.getData = ^(NSUInteger index) {

CGFloat yValue = [data02Array[index] floatValue]; return [PNLineChartDataItem dataItemWithY:yValue];

};

lineChart.chartData = @[data01, data02];
[lineChart strokeChart];

import "PNChart.h"

//For BarC hart
PNBarChart * barChart = [[PNBarChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)];
[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 Circle Chart

PNCircleChart * circleChart = [[PNCircleChart alloc] initWithFrame:CGRectMake(0, 80.0, SCREEN_WIDTH, 100.0) total:[NSNumber numberWithInt:100] current:[NSNumber numberWithInt:60] clockwise:NO shadow:NO];
circleChart.backgroundColor = [UIColor clearColor];
[circleChart setStrokeColor:PNGreen];
[circleChart strokeChart];

import "PNChart.h"

//For Pie Chart
NSArray *items = @[[PNPieChartDataItem dataItemWithValue:10 color:PNRed],

[PNPieChartDataItem dataItemWithValue:20 color:PNBlue description:@'WWDC'], [PNPieChartDataItem dataItemWithValue:40 color:PNGreen description:@'GOOL I/O'], ];

PNPieChart *pieChart = [[PNPieChart alloc] initWithFrame:CGRectMake(40.0, 155.0, 240.0, 240.0) items:items];
pieChart.descriptionTextColor = [UIColor whiteColor];
pieChart.descriptionTextFont = [UIFont fontWithName:@"Avenir-Medium" size:14.0];
[pieChart strokeChart];

import "PNChart.h"

//For Scatter Chart

PNScatterChart *scatterChart = [[PNScatterChart alloc] initWithFrame:CGRectMake(SCREEN_WIDTH /6.0 - 30, 135, 280, 200)];
[scatterChart setAxisXWithMinimumValue:20 andMaxValue:100 toTicks:6];
[scatterChart setAxisYWithMinimumValue:30 andMaxValue:50 toTicks:5];

NSArray * data01Array = [self randomSetOfObjects];
PNScatterChartData *data01 = [PNScatterChartData new];
data01.strokeColor = PNGreen;
data01.fillColor = PNFreshGreen;
data01.size = 2;
data01.itemCount = [[data01Array objectAtIndex:0] count];
data01.inflexionPointStyle = PNScatterChartPointStyleCircle;
__block NSMutableArray *XAr1 = [NSMutableArray arrayWithArray:[data01Array objectAtIndex:0]];
__block NSMutableArray *YAr1 = [NSMutableArray arrayWithArray:[data01Array objectAtIndex:1]];
data01.getData = ^(NSUInteger index) {

CGFloat xValue = [[XAr1 objectAtIndex:index] floatValue]; CGFloat yValue = [[YAr1 objectAtIndex:index] floatValue]; return [PNScatterChartDataItem dataItemWithX:xValue AndWithY:yValue];

};

[scatterChart setup];
self.scatterChart.chartData = @[data01];
/*
this is for drawing line to compare
CGPoint start = CGPointMake(20, 35);
CGPoint end = CGPointMake(80, 45);
[scatterChart drawLineFromPoint:start ToPoint:end WithLineWith:2 AndWithColor:PNBlack];
*/
scatterChart.delegate = self;

github地址:
https://github.com/kevinzhow/PNChart

开题报告开题报告


这里还有:


还可以点击去查询:
[自定义]    [图定]    [制表]    [PNChart]    [iOS可自定义图定制表库 - PNChart]   

请扫码加微信 微信号:sj52abcd


下载地址: http://www.taolw.com/down/7456.docx
  • 上一篇:app起始空白页 - DZNEmptyDataSet
  • 下一篇:微信自定义毕业设计查询框实现