CorePlot 中的多个 y 轴

发布于 2024-10-08 19:08:59 字数 680 浏览 0 评论 0原文

我试图在 iPhone 上使用 CorePlot 完成的任务是在两个不同的 PlotSpace 中绘制两个图表。第一个 PlotSpace 的 y 轴应出现在左侧,第二个 PlotSpace 的 y 轴应出现在右侧。

该文档暗示这应该是可能的,但我不知道如何实现它。

我尝试了以下方法,但惨败:

 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;

我得到的只是 3 个 x 轴。

知道我怎样才能做到这一点吗?

What I'm trying to accomplish with CorePlot on the iPhone is to plot two graphs in two different PlotSpaces. The y-Axis of the first PlotSpace should appear on the left and the y-Axis of the second one on the right.

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.

Any idea how I could accomplish this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情丝乱 2024-10-15 19:08:59

您需要指定 y 轴:

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

You need to specify which are the y-axes:

leftY.coordinate = CPCoordinateY;
rightY.coordinate = CPCoordinateY;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文