我只是浏览课程一个小时,无法找到它!我开始搜索AAPLot项目的示例.
我稍微更改了图表,并期望在CPTTradingRangePlot类中找到所有设置,但它不存在.
有很多属性我可以改变,但我找不到任何类的背景设置.
任何人都可以给我一个暗示吗?
// OHLC plot
CPTMutableLineStyle *whiteLineStyle = [CPTMutableLineStyle lineStyle];
whiteLineStyle.lineColor = [CPTColor whiteColor];
whiteLineStyle.lineWidth = 1.0f;
CPTTradingRangePlot *ohlcPlot = [[[CPTTradingRangePlot alloc] initWithFrame:graph.bounds] autorelease];
ohlcPlot.identifier = @"OHLC";
ohlcPlot.lineStyle = whiteLineStyle;
ohlcPlot.barWidth = 4.0f;
ohlcPlot.increaseFill = [(CPTFill *)[CPTFill alloc] initWithColor:[CPTColor greenColor]];
ohlcPlot.decreaseFill = [(CPTFill *)[CPTFill alloc] initWithColor:[CPTColor redColor]];
CPTMutableTextStyle *whiteTextStyle = [CPTMutableTextStyle textStyle];
whiteTextStyle.color = [CPTColor whiteColor];
whiteTextStyle.fontSize = 12.0;
ohlcPlot.labelTextStyle = whiteTextStyle;
ohlcPlot.labelOffset = 5.0;
ohlcPlot.stickLength = 2.0f;
ohlcPlot.dataSource = self;
ohlcPlot.plotStyle = CPTTradingRangePlotStyleCandleStick;
[graph addPlot:ohlcPlot];
Run Code Online (Sandbox Code Playgroud) 我在散点图中使用了两个 y 轴(y 和 y2),我想将每个轴的标题放置在相同的高度。
请参考我下面的示例图表,其中有两个标题(y:“USD”和 y2:“ev/ebit”)。不幸的是,我没有找到在完全相同的高度(y 值)绘制两个标题的方法。
这是我目前计算标题的 y 位置的方式:
double yTitleLocation = plotSpace.yRange.lengthDouble + plotSpace.yRange.locationDouble;
yAxis.titleLocation = CPTDecimalFromDouble(yTitleLocation);
yAxis.title = self.issue.company.contrCurrency;
yAxis.titleRotation = 2 * M_PI;
yAxis.titleOffset = -15;
double y2TitleLocation = valuationPlotSpace.yRange.lengthDouble + valuationPlotSpace.yRange.locationDouble;
y2Axis.titleLocation = CPTDecimalFromDouble(y2TitleLocation);
y2Axis.title = self.valuation.id;
y2Axis.titleRotation = 2 * M_PI;
Run Code Online (Sandbox Code Playgroud)
我需要如何更改我的代码以在两个 y 轴的相同 y 值处绘制标题?
你有什么建议让我的 y 轴标题左对齐,y2 轴右对齐。我目前在 y 轴上使用 titleOffset,但相信可能有更好的方法来做到这一点。
谢谢!

Core-Plot框架中bug修复后的图表:(请参考下面的答案1)

我添加了这个代码片段来展示我如何设置图表和两个散点图(股票价格和估值):
graph = [[CPTXYGraph alloc] initWithFrame:CGRectZero];
self.hostView.hostedGraph = graph;
[graph applyTheme:[CPTTheme themeNamed:kCPTPlainWhiteTheme]];
graph.frame = self.view.bounds;
graph.plotAreaFrame.masksToBorder = …Run Code Online (Sandbox Code Playgroud) 在CorePlot中,CPTXYGraph是否可以在Y轴上显示int值而不是十进制值?
在使用Core plot API和ESRI map Arc GIS API时,我遇到了重复的符号问题.在我的应用程序中,我使用的是Core plot和ArcGIS API.为了提供对64位设备的支持,我已经为ArcGI(ESRI map)下载了新的API,并因此更新了64位的CorePlot API.在进行更改后,我面临的问题是:
错误描述在这里:
duplicate symbol _squareOfDistanceBetweenPoints in:
/Users/xxxx/Library/SDKs/ArcGIS/iOS/ArcGIS.framework/ArcGIS(AGSCPTUtilities.o)
/Users/xxxx/Desktop/18 Nov/SCM_iPad/SCM/CorePlot/coreplot_new.a(CPTUtilities.o)
duplicate symbol _niceNum in:
/Users/xxxx/Library/SDKs/ArcGIS/iOS/ArcGIS.framework/ArcGIS(AGSCPTAxis.o)
/Users/xxxx/Desktop/18 Nov/SCM_iPad/SCM/CorePlot/coreplot_new.a(CPTAxis.o)
duplicate symbol _CreateRoundedRectPath in:
/Users/xxxx/Library/SDKs/ArcGIS/iOS/ArcGIS.framework/ArcGIS(AGSCPTPathExtensions.o)
/Users/xxxx/Desktop/18 Nov/SCM_iPad/SCM/CorePlot/coreplot_new.a(CPTPathExtensions.o)
duplicate symbol _AddRoundedRectPath in:
/Users/xxxx/Library/SDKs/ArcGIS/iOS/ArcGIS.framework/ArcGIS(AGSCPTPathExtensions.o)
/Users/xxxx/Desktop/18 Nov/SCM_iPad/SCM/CorePlot/coreplot_new.a(CPTPathExtensions.o)
duplicate symbol _MyCGPathApplierFunc in:
/Users/xxxx/Library/SDKs/ArcGIS/iOS/ArcGIS.framework/ArcGIS(NSCoderExtensions.o)
/Users/xxxx/Desktop/18 Nov/SCM_iPad/SCM/CorePlot/coreplot_new.a(NSCoderExtensions.o)
ld: 5 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)
如果有人面临问题请建议.我无法弄清楚这些API中有什么重复这些两个工作正常(没有64位支持的OLD api)
我在uiview子类中创建了一个活动指示器和一个标签,并在许多不同的tab中调用它.除了Graph Hosting视图(CPTGraphHostinView)之外,它在我调用它的大多数地方都能正常工作.在这个特定的视图中,subView看起来是颠倒的.标签位于微调器上方.我尝试使用imageview而不是标签,并使用相同的倒置图像.
这是我的initWithframe方法
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
// Initialization code.
NSLog(@"AI: init with frame");
spinnerView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
spinnerView.center = self.center;
[self addSubview:spinnerView];
UILabel* loadingMsg = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 90.0f, 30.0f)];
loadingMsg.center = CGPointMake(spinnerView.center.x , spinnerView.center.y + spinnerView.bounds.size.height/2 +10);
loadingMsg.textAlignment = UITextAlignmentCenter;
loadingMsg.backgroundColor = [UIColor clearColor];
loadingMsg.text = @"loading";
[self addSubview:loadingMsg];
}
return self;
}
Run Code Online (Sandbox Code Playgroud)
这里是对activityIndicator的调用,在视图中加载了
ob_activityobject = [[ActivityIndicator alloc] initWithFrame:self.view.bounds];
[ob_activityobject showInView:self.view];
Run Code Online (Sandbox Code Playgroud)

在我的散点图中,我使用Core-Plot的自动缩放功能,根据我的测试图(见下文),它似乎工作正常.
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace;
[plotSpace scaleToFitPlots:[NSArray arrayWithObject:sharePricePlot]];
[valuationPlotSpace scaleToFitPlots:[NSArray arrayWithObject:valuationPlot]];
CPTMutablePlotRange *xRange = [plotSpace.xRange mutableCopy];
CPTMutablePlotRange *yRange = [plotSpace.yRange mutableCopy];
[xRange expandRangeByFactor:CPTDecimalFromDouble(1.0)];
[yRange expandRangeByFactor:CPTDecimalFromDouble(1.0)];
plotSpace.xRange = xRange;
plotSpace.yRange = yRange;
Run Code Online (Sandbox Code Playgroud)
我为我的x轴使用自定义标签,我在标准枚举中设置.在此枚举中,我根据演示应用程序设置每个轴标签,如下所示:
CPTAxisLabel *newLabel = [[CPTAxisLabel alloc] initWithText:[NSString stringWithFormat:@"%u", year]
textStyle:xAxis.labelTextStyle];
newLabel.tickLocation = CPTDecimalFromUnsignedInteger(idx);
newLabel.offset = 0;
[xAxisLabels addObject:newLabel];
Run Code Online (Sandbox Code Playgroud)
但是,即使我将偏移设置为0,它应该将标签定位在非常靠近x轴的位置(在我的视图中),轴和标签之间的偏移也会根据y值的范围而有所不同(请参阅到下面亚马逊和Priceline的图表).
如何设置x轴和标签之间的距离,与(自动缩放的)y值无关?
图1:亚马逊

图2:Priceline

谢谢!
我们目前正在使用Coreplot,但似乎Coreplot不支持缩放和平移.我们如何实现这一目标?
我试图在iPhone应用程序中使用Core Plot绘制简单的统计数据.我最初使用标签政策作为两个轴的CPTAxisLabelingPolicyAutomatic,并且网格线看起来很好,如下所示:

您可以看到图形具有垂直和水平网格线.然后,我将标签政策更改为
axisSet.xAxis.labelingPolicy = CPTAxisLabelingPolicyNone;
axisSet.yAxis.labelingPolicy = CPTAxisLabelingPolicyAutomatic;
NSUInteger labelLocation = 0;
NSMutableArray *customLabels = [NSMutableArray arrayWithCapacity:xAxisLabels.count];
CPTMutableTextStyle *textStyle = [[CPTMutableTextStyle alloc] init];
textStyle.color = [CPTColor lightGrayColor];
for (NSNumber *tickLocation in customTickLocations) {
CPTAxisLabel *newLabel = [[CPTAxisLabel alloc]
initWithText:[NSString stringWithFormat:@"%@",(NSDate *)[xAxisLabels objectAtIndex:labelLocation++]] textStyle:textStyle];
newLabel.tickLocation = [tickLocation decimalValue];
newLabel.rotation = 25.0;
newLabel.offset = 10.0;
[customLabels addObject:newLabel];
}
axisSet.xAxis.axisLabels = [NSSet setWithArray:customLabels];
Run Code Online (Sandbox Code Playgroud)
但是,因为当我为X轴添加自定义标签时,X轴网格线(即垂直线)没有出现.只能看到水平网格线,您可以在App的下方屏幕截图中看到:

我有这个情节:

X轴上的每个刻度表示日历中的一天.但正如你所看到的,日期很难阅读,因此我想将缩放级别设置为仅显示7天而不是11天(就像现在一样).请看下面的截图:

但是,拥有更多数据非常重要,因此用户可以向左滚动,但仍会显示日期.
我该怎么办?
提前致谢.