简体   繁体   English

CorePlot中的多个y轴

[英]Multiple y-Axis in CorePlot

What I'm trying to accomplish with CorePlot on the iPhone is to plot two graphs in two different PlotSpaces. 我想用iPhone上的CorePlot完成的是在两个不同的PlotSpaces中绘制两个图形。 The y-Axis of the first PlotSpace should appear on the left and the y-Axis of the second one on the right. 第一个PlotSpace的y轴应出现在左侧,y轴应出现在右侧的第二个轴上。

The documentation gives a hint that it should be possible but I have no idea how to accomplish it. 文档提供了一个提示,它应该是可能的,但我不知道如何实现它。

I tried the following but failed miserably: 我试过以下但是失败了:

 CPXYAxis *leftY = [[[CPXYAxis alloc] init] autorelease];
 CPXYAxis *rightY = [[[CPXYAxis alloc] init] autorelease];
 CPXYAxis *x = [[[CPXYAxis alloc] init] autorelease];

 CPAxisSet *axisSet = [[[CPAxisSet alloc] init] autorelease];
 axisSet.axes = [NSArray arrayWithObjects:x,leftY,rightY,nil];
 graph.axisSet = axisSet;

 leftY.plotSpace = leftAxisPlotSpace;
 rightY.plotSpace = rightAxisPlotSpace;
 x.plotSpace = rightAxisPlotSpace;

All I get are 3 x-Axis. 我得到的只是3 x轴。

Any idea how I could accomplish this? 知道我怎么能做到这一点?

You need to specify which are the y-axes: 您需要指定哪些是y轴:

leftY.coordinate = CPCoordinateY;
rightY.coordinate = CPCoordinateY;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM