我想在核心图中添加类似于下图的数据指标线.
情节图片http://img203.imageshack.us/img203/9412/plota.png
任何想法如何使用核心情节来实现这一目标.我刚刚开始了解核心情节,所以任何提示都会非常有用.
谢谢
编辑:
为了更好地理解,我创建了一个截屏来展示我的意思:
http://www.screencast.com/users/GauravVerma/folders/Jing/media/78fbef04-8785-46d6-9347-4f35d257109c
2月26日补充:
我已经通过使用两个数据时隙解决了部分问题.这是当前的实现:
http://www.screencast.com/users/GauravVerma/folders/Jing/media/02a1e685-8bf8-41a9-aaa6-5ea6445f6a6c
我使用了两个数据槽,一个是主数据槽,另一个是仅绘制一个数据点,当滑块值改变时重新加载.
这是我的数据源方法(可能会帮助某人):
-(NSUInteger)numberOfRecordsForPlot:(CPPlot *)plot {
if ([(NSString *)plot.identifier isEqualToString:@"Blue Plot"]){
return [dataForPlot count];
}else {
return 1;
}
}
-(NSNumber *)numberForPlot:(CPPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index
{
if ([(NSString *)plot.identifier isEqualToString:@"Green Plot"]) {
index = floor((double)[slider value]);
if (index > [dataForPlot count] -1) {
index = [dataForPlot count] -1;
}
NSLog(@"Green plot index : %f",index);
}
NSNumber *num = [[dataForPlot objectAtIndex:index] valueForKey:(fieldEnum == CPScatterPlotFieldX ? @"x" : @"y")];
num = [NSNumber numberWithDouble:[num …Run Code Online (Sandbox Code Playgroud) 当用户点击(或触摸)使用Core Plot创建的mye图上的plotSymbol时,我正在尝试运行一些代码.
这不适用于scatterPlot:
-(void)scatterPlot:(CPScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex: (NSUInteger)index
{
NSLog(@"plotSymbolWasSelectedAtRecordIndex %d", index);
}
Run Code Online (Sandbox Code Playgroud)
但是当我使用barPlot时这很有效:
-(void)barPlot:(CPBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index
{
NSLog(@"barWasSelectedAtRecordIndex %d", index);
}
Run Code Online (Sandbox Code Playgroud)
当用户点击或触摸我的scatterPlot时,我尝试捕获的内容是什么?
我正在使用coreplot 0.9.我曾尝试为CPTLineStyle设置linecolor属性
CPTLineStyle *lineStyle = [CPTLineStyle lineStyle];
lineStyle.lineColor=[UIColor grayColor];
Run Code Online (Sandbox Code Playgroud)
但它给出的错误是linecolor是readonly属性.请给我一些解决方案.
我正在使用核心图来制作具有长xAxis范围的折线图.我使图形的垂直方向固定/恒定,让它只能水平滚动.但是,如果我开始水平滚动/滑动,则y轴不会移动(如x标签).y轴仅在图形的起始点可见.如果有人能帮助我,我将不胜感激.非常感谢你提前.
嗨,我正在使用核心图标头开发IOS应用程序.我有不同的UI用于风景和肖像.当我试图修改UIview的帧时,取向变化我在等待10秒后无法返回.主运行循环模式:kCFRunLoopDefaultMode void SendDelegateMessage(NSInvocation*):delegate.有人可以建议我做什么.
使用CorePlot 1.6版.运行iOS 8.3.
我正在使用Core-Plot和ScatterPlot来表示多行.当我滚动时,图形移动到跳跃并锁定.我不知道会发生什么.你能帮助我吗?这是我的代码:
#import <UIKit/UIKit.h>
#import "CorePlot-CocoaTouch.h"
@interface TemporalLineViewController:UIViewController<CPTPlotDataSource,
CPTScatterPlotDelegate>
@property (strong, nonatomic) IBOutlet CPTGraphHostingView *hostingView;
@end
@interface TemporalLineViewController (){
NSMutableDictionary *dates;
}
@property (nonatomic, readwrite, strong) NSArray *plotData;
@end
@implementation TemporalLineViewController
-(CPTGraph *)createGraph{
initWithFrame:CGRectMake(viewGraph.frame.origin.x, viewGraph.frame.origin.y, 500, viewGraph.frame.size.height)];
CPTGraph *graph = [[CPTXYGraph alloc] initWithFrame:hostingView.bounds];
[graph applyTheme:[CPTTheme themeNamed:kCPTSlateTheme]];
hostingView.hostedGraph=graph;
// Axes
CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet;
CPTXYAxis *x = axisSet.xAxis;
x.majorIntervalLength = CPTDecimalFromDouble(ONEDAY);
x.orthogonalCoordinateDecimal = CPTDecimalFromDouble(0.0);
x.minorTicksPerInterval = 0;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"dd/MM/yyyy"];
CPTTimeFormatter *timeFormatter = …Run Code Online (Sandbox Code Playgroud) 我正试图向上移动x轴标签.有没有我可以设置的财产?我已经尝试在绘图框中添加一些底部填充,但所有这一切都是向上挤压整个绘图.
我昨天问了这个问题,得到了Eric Skroch的一些帮助.但是,在查看Core Plot网站上的所有文档以及一些示例后,我仍然有点困惑.所以我将发布到目前为止的代码,看看是否有人可以帮我一些.也许Eric也会更容易帮助.我的问题是我需要删除一个情节,然后在选项卡式应用程序中将其替换为另一个情节.Eric和其他人说过要使用reloadData方法.但我不知道我的代码可以在哪里使用它?这是我的标题和实现文件.
#import <UIKit/UIKit.h>
#import "CorePlot-CocoaTouch.h"
@interface GraphViewController : UIViewController <CPTPlotDataSource>
@property (nonatomic, strong) CPTGraphHostingView *hostView;
@property (nonatomic, strong) NSMutableArray *myData;
@property (nonatomic) float XAXISMIN;
@property (nonatomic) float XAXISMAX;
@property (nonatomic) float YAXISMIN;
@property (nonatomic) float YAXISMAX;
@property (strong, nonatomic) IBOutlet UILabel *noGraph;
@end
Run Code Online (Sandbox Code Playgroud)
和
#import "GraphViewController.h"
#import "MyVariables.h" // a singleton class for my variables
@interface GraphViewController ()
@end
@implementation GraphViewController
@synthesize hostView = _hostView;
@synthesize myData = _myData;
@synthesize XAXISMIN;
@synthesize XAXISMAX;
@synthesize YAXISMAX;
@synthesize noGraph;
@synthesize …Run Code Online (Sandbox Code Playgroud) 我正在使用自定义图像符号,如在散点图上显示图像作为核心图iOS中的绘图符号中所述.另请参阅CPTBarPlot(Core-Plot)上的定位标签,关于数据标签在a中的定位CPTPlot.
但是,我没有看到CPTScatterPlot.labelOffset我需要的行为.正值会增加图像底部和点之间的距离,而负值会增加图像顶部和点之间的距离.我需要将图像置于点上.查看截图:


我的解决方案是hacky,并要求我在我CustomImageForScatterPlot的drawInContext方法中修改图像框架.关于如何按labelOffset我的方式工作的任何想法?
我阅读了关于如何使用核心情节的教程(http://www.raywenderlich.com/13269/how-to-draw-graphs-with-core-plot-part-1)我正在研究的项目是用迅速.
我做了一切来导入CorePlot库.为了确保我做得对,我创建了一个新的目标C文件并调用
#import "CorePlot-CocoaTouch.h"
Run Code Online (Sandbox Code Playgroud)
它在测试objective-c文件中工作(构建没有错误)
然后我将import语句放在桥接头文件中,并得到27个错误,所有说"...当前部署目标不支持自动__weak"
从这篇文章(Swift中的CorePlot不能称为"numberForPlot"),我知道我可以以某种方式在我的快速项目中使核心情节工作.
谁能推荐一些东西?
谢谢你的帮忙.
我按照以下步骤导入库:
静态库安装您也可以直接将Core Plot库以二进制形式复制到项目中.
将CorePlotHeaders目录复制到Xcode项目
将Core Plot库复制到Xcode项目.
打开您的应用程序目标构建设置,对于其他链接器标志包括:
-ObjC(-all_load曾经被要求作为链接器标志,但在Xcode 4.2中不再需要它)
将QuartzCore框架添加到项目中.
将Accelerate框架添加到项目(版本2.0及更高版本).
将项目构建设置中的C/C++编译器更改为LLVM GCC 4.2或LLVM 1.6.