ios中core Plot (2)
#import "ViewController.h" @interface ViewController ()
//指定要画得view
@property(nonatomic,assign)CPTGraphHostingView *hostview;
//指定画布
@property(nonatomic,retain)CPTXYGraph *graph; @property(nonatomic,retain)NSMutableArray *data;
@end @implementation ViewController - (void)viewDidLoad
{
[super viewDidLoad];
self.data=[NSMutableArray array];
for (int i=; i<; i++) { id x=[NSNumber numberWithInt:i];
id y=[NSNumber numberWithInt:(i+0.11)];
[self.data addObject:@{@"x":x,@"y":y}];
}
self.hostview=[[CPTGraphHostingView alloc] initWithFrame:CGRectMake(, , , )]; //创建x,Y轴画布
self.graph=[[[CPTXYGraph alloc] initWithFrame:CGRectZero] autorelease];
//设置主题
CPTTheme *them=[CPTTheme themeNamed:kCPTStocksTheme];
//设置x.y周画布的主题
[self.graph applyTheme:them]; self.graph.paddingBottom=0.0f;
self.graph.paddingLeft=0.0f;
self.graph.paddingRight=0.0f;
self.graph.paddingTop=0.0f;
self.hostview.hostedGraph=self.graph;
[self.view addSubview:self.hostview]; CPTMutableLineStyle *linestyle=[CPTMutableLineStyle lineStyle];
linestyle.lineWidth=3.0f;
linestyle.lineColor=[CPTColor redColor];
linestyle.miterLimit=1.0f; CPTScatterPlot *scatter=[[CPTScatterPlot alloc] init];
scatter.dataLineStyle=linestyle;
scatter.dataSource=self;
scatter.identifier=@"red";
[self.graph addPlot:scatter]; } -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot;{
return self.data.count;
} -(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index{
NSString *key= (fieldEnum==CPTScatterPlotFieldX?@"x":@"y");
NSDictionary *dic=self.data[index];
NSLog(@"%@--->%@",key,dic[key]);
return dic[key]; } - (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} - (void)dealloc
{
[_graph release];
[super dealloc];
} @end
ios中core Plot (2)的更多相关文章
- iOS 使用 Core Plot 绘制统计图表入门
本文转载至 http://blog.csdn.net/zhibudefeng/article/details/7677457 iOS(iPhone/iPad) 下图形组件有两个有名的,s7gra ...
- ios中Core Location跟Map Kit的基本使用
地图类开发应用中,离不开地理位置跟MKMapView的使用,下面就记录下自己在使用这两个东西中学到的. 不过并不是所有苹果的设备都支持地理位置,我们在使用前应该做个判断,代码如下: BOOL loca ...
- 如何使用 Core Plot 的 API 帮助文档
Core Plot 可是 iOS 下绝好的图表组件,虽说它的相关资料不甚丰富,特别是中文的,英文的还是有几篇不错的文章,不过 Core Plot 自身提供的 API 帮助文档,以及代码示例其实很有用的 ...
- iOS中数据库应用基础
iOS 数据库入门 一.数据库简介 1.什么是数据库? 数据库(Database) 是按照数据结构来组织,存储和管理数据的仓库 数据库可以分为2大种类 关系型数据库(主流) PC端 Oracle My ...
- 谈谈iOS中的屏幕方向
众所周知,iOS中提供了[UIDevice currentDevice].orientation与[UIApplication sharedApplication].statusBarOrientat ...
- iOS 图形处理 Core Graphics Quartz2D 教程
Core Graphics Framework是一套基于C的API框架,使用了Quartz作为绘图引擎.它提供了低级别.轻量级.高保真度的2D渲染.该框架可以用于基于路径的 绘图.变换.颜色管理.脱屏 ...
- iOS中的数据持久化方式
iOS中的数据持久化方式,基本上有以下四种:属性列表.对象归档.SQLite3和Core Data. 1.属性列表 涉及到的主要类:NSUserDefaults,一般 [NSUserDefaults ...
- ios中常见数据存储方式以及SQLite常用的语句
在iOS中,根据不同的需求对应的有多种数据存储方式: 1.NSUserdefaults 将数据存储到沙盒中(library),方便易用,但是只能存储系统提供的数据类型(plist),不能存储自定义的 ...
- IOS中调用系统的电话、短信、邮件、浏览功能
iOS开发系列--通讯录.蓝牙.内购.GameCenter.iCloud.Passbook系统服务开发汇总 2015-01-13 09:16 by KenshinCui, 26990 阅读, 35 评 ...
随机推荐
- iOS开发-策略模式
策略(Strategy)模式定义了一系列的算法,并将每一个算法封装起来,而且使它们还可以相互替换.策略模式让算法独立于使用它的客户而独立变化.策略模式是对算法的包装,是把使用算法的责任和算法本身分割开 ...
- sql server2008R2 无法连接到WMI提供程序。你没有权限或者该服务器无法访问
在自己的Win8.1的系统在安装了Vs2013和Sqlserver2008R2 今天在打开ssms的时候发现连接不上数据库,且出现了以下问题 然后打开Sqlserver配置管理器准备看看sqlserv ...
- Linux 查看服务器配置
//CPU cat /proc/cpuinfo |grep processor; //内存 free -g; //硬盘 df -h;
- [React] Asynchronously Load webpack Bundles through Code-splitting and React Suspense
One approach to building high performance applications with webpack is to take advantage of code-spl ...
- 机器学习之深入理解SVM
在浏览本篇博客之前,最好先查看一下我写的还有一篇文章机器学习之初识SVM(点击可查阅哦).这样能够更好地为了结以下内容做铺垫! 支持向量机学习方法包括构建由简至繁的模型:线性可分支持向量机.线性支持向 ...
- PowerDesigner设计的数据库 ORA-0092
异常 数据库由Powerdesigner设计,格式为Oracle10g,由Powerdesigner生成的数据库并没报什么异常,使用navicat也能正常操作,而使用PLSQL Developer去出 ...
- ArcGIS Add-in ValidateAddInXMLTask”任务意外失败
晚上收假回来调一Add-In程序,遇到编译错误:"ValidateAddInXMLTask"任务意外失败. error MSB4018: System.IO.FileNotFoun ...
- 树莓派系统(Debain)中设置固定静态IP地址
一.方法: 1.使用ssh登陆,使用以下命令设置静态ip. sudo nano /etc/dhcpcd.conf2.在dhcpcd.conf后添加以下内容(网上的方法): interface eth0 ...
- 008-Go 关于字符串拼接
如果是少量小文本拼接,用 “+” 如果是大量小文本拼接,用 strings.Join 如果是大量大文本拼接,用 bytes.Buffer package main import( "fmt& ...
- Tomcat访问日志浅析 (转)
来自:http://blog.chinaunix.net/uid-20691565-id-3938220.html Tomcat的访问日志是靠org.apache.catalina.valves.Ac ...