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 评 ...
随机推荐
- [leetcode]Permutations @ Python
原题地址:https://oj.leetcode.com/problems/permutations/ 题意: Given a collection of numbers, return all po ...
- 随机蕨(Random Fern)
最近在做 Zdenek Kalal 的 TLD 算法,其成果发表在CVPR 2010 上,文章的名字叫做 P-N Learning: Bootstrapping Binary Classifiers ...
- Intent 简介 结构 传递数据 常见Action 常量 MD
Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...
- 微信小程序表单校验WxValidate.js使用
WxValidate插件是参考 jQuery Validate 封装的,为小程序表单提供了一套常用的验证规则,包括手机号码.电子邮件验证等等,同时提供了添加自定义校验方法,让表单验证变得更简单. 首先 ...
- Active Learning
怎么办?进行Active Learning主动学习 Active Learning是最近又流行起来了的概念,是一种半监督学习方法. 一种典型的例子是:在没有太多数据的情况下,算法通过不断给出在决策边界 ...
- 创业公司做数据分析(四)ELK日志系统 (转)
http://blog.csdn.net/zwgdft/article/details/53842574 作为系列文章的第四篇,本文将重点探讨数据采集层中的ELK日志系统.日志,指的是后台服务中产生的 ...
- Springmvc 上传文件MultipartFile 转File
转自:http://blog.csdn.net/boneix/article/details/51303207 业务场景:ssm框架 上传文件到应用服务器过程中要传到专有的文件服务器并返回url进行其 ...
- 使用jstl报错:Can not find the tag library descriptor for “http://java.sun.com/jstl/core”
使用jstl报错:Can not find the tag library descriptor for “http://java.sun.com/jstl/core” 出现这个错误的原因是项目中没有 ...
- Linux下安装Supervisor的多种方法
一.安装 1.方法一: pip install supervisor #!/bin/bash wget http://pypi.python.org/packages/source/s/setupt ...
- angular中的 登录检查 和 过期Session清理
angular利用ui-router进行登录检查 SAP都会有这个问题,session过期或者页面被刷新的情况下应该进入登录页. 监听ui-router的satte事件可以实现当state切换的时候检 ...