我完全不熟悉Core Plot并且有一个工作条形图,但视觉对我来说没用,除非我知道每个条形图中都有哪个对象.我已经看到有一个名为'fieldIdentifiers'的方法,但不知道如何实现它,也找不到任何文档(如果这是正确的方法).你能引导我朝正确的方向前进吗?谢谢!
我希望绘制一个折线图,其中x轴定义为两个日期之间的天数,y轴是每个日期变化的值.
我可以将y值绘制为NSNumber,但我不知道如何在x轴上设置范围和标记.我查看了核心图分布的"examples"目录中的日期示例,但发现它有点令人困惑.
有没有人知道一个教程或代码示例,这可能会在这方面给我一个问题?
先感谢您.
我正在使用Core Plot框架绘制饼图,并且在绘制饼图本身时没有任何问题.
但是,我需要饼图本质上是交互式的,即,如果我点击饼图中的任何特定部分,它应该触发导航到显示该特定部分的详细信息的页面.
我尝试使用该方法-(void)pieChart:sliceWasSelectedAtRecordIndex:,但从未调用该委托方法.启用此触摸交互需要什么?
我想禁用核心图中的滚动.我有一个关于通过设置属性globalXrange和globalYRange来限制CPXYPlotSpace范围的想法,但这并不能解决我的目的,因为我需要修改轴并且不希望在我的图上有滚动效果.早期版本的核心图用于具有此功能,但似乎已在CPGraphHostingView中启用了最新版本滚动.
这是我的代码:
CPTXYPlotSpace *barGraphPlotSpace = [[CPTXYPlotSpace alloc] init];
barGraphPlotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(0.0) length:CPDecimalFromFloat(100.0)];
CPTXYAxis *rightY = [[CPTXYAxis alloc] init];
rightY.coordinate = CPTCoordinateY;
rightY.orthogonalCoordinateDecimal = CPTDecimalFromFloat(oneDay*7);
rightY.plotSpace = barGraphPlotSpace;
[graph addPlotSpace:barGraphPlotSpace];
Run Code Online (Sandbox Code Playgroud)
但是,这不会在我的图表中添加另一个轴.
我要做的是得到第二个y轴,它将从0-100(百分比).为此,我创建了一个新的绘图空间和一个新的y轴,将新的绘图空间添加到y轴并将绘图空间添加到图形中.
我究竟做错了什么?
谢谢.
如何将Core Plot框架安装到Xcode 4中?
这个较旧的教程有关于如何为Xcode 3安装它的说明,但是我找不到任何类似的Xcode 4指令.为了将这个框架与更新的Xcode一起使用,我需要做什么?
我是coreplot的新手,我希望沿着使用coreplot绘制的条形图的x轴显示NSdate(年或月或日).我已经通过一些样本沿x轴绘制NSDate.但我无法绘制..
请任何人都可以提供沿X轴绘制NSDate的代码...谢谢
我尝试了stackoverflow中的以下代码,但无法在x轴上显示标签
// If you make sure your dates are calculated at noon, you shouldn't have to
// worry about daylight savings. If you use midnight, you will have to adjust
// for daylight savings time.
NSDate *refDate = [NSDate dateWithTimeIntervalSinceReferenceDate:31556926 * 10];
NSTimeInterval oneDay = 24 * 60 * 60;
// Invert graph view to compensate for iOS coordinates
//CGAffineTransform verticalFlip = CGAffineTransformMakeScale(1,-1);
// self.view.transform = verticalFlip;
// allocate the graph within the current view bounds
graph = …Run Code Online (Sandbox Code Playgroud) 以下代码为饼图CorePlot in ios:
CPTGraphHostingView *hostingView = [[CPTGraphHostingView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:hostingView];
graph = [[CPTXYGraph alloc] initWithFrame:self.view.bounds];
hostingView.hostedGraph = graph;
CPTPieChart *pieChart = [[CPTPieChart alloc] init];
pieChart.dataSource = self;
pieChart.pieRadius = 100.0;
pieChart.identifier = @"PieChart1";
pieChart.startAngle = M_PI_4;
pieChart.sliceDirection = CPTPieDirectionCounterClockwise;
self.pieData= [NSMutableArray arrayWithObjects:[NSNumber numberWithDouble:90.0],
[NSNumber numberWithDouble:20.0],
[NSNumber numberWithDouble:30.0],
[NSNumber numberWithDouble:40.0],
[NSNumber numberWithDouble:50.0], [NSNumber numberWithDouble:60.0], nil];
[graph addPlot:pieChart];
[pieChart release];
Run Code Online (Sandbox Code Playgroud)
这是输出不会隐藏饼图中的x和y轴....!我需要隐藏X和y轴......!帮我 ....!
我正在使用核心情节.当我尝试自定义CPTTextStyle.color的值时,我发现它是只读的!谁能告诉我怎样才能改变颜色属性的值?
我正在使用Xcode 5并在尝试编译使用Core Plot的iOS应用程序时收到以下错误:
Implicit conversion from enumeration type 'enum UILineBreakMode' to different enumeration type 'NSLineBreakMode' (aka 'enum NSLineBreakMode')
Run Code Online (Sandbox Code Playgroud)
错误在于CPTTextStylePlatFormSpecific.m:
-(void)drawInRect:(CGRect)rect withTextStyle:(CPTTextStyle *)style inContext:(CGContextRef)context
{
if ( style.color == nil ) {
return;
}
CGContextSaveGState(context);
CGColorRef textColor = style.color.cgColor;
CGContextSetStrokeColorWithColor(context, textColor);
CGContextSetFillColorWithColor(context, textColor);
CPTPushCGContext(context);
UIFont *theFont = [UIFont fontWithName:style.fontName size:style.fontSize];
[self drawInRect:rect
withFont:theFont
lineBreakMode:**UILineBreakModeWordWrap** // ERROR!!
alignment:(NSTextAlignment)style.textAlignment];
CGContextRestoreGState(context);
CPTPopCGContext();
}
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个错误?