开发者

Multiple y-Axis in CorePlot

开发者 https://www.devze.com 2023-02-01 02:57 出处:网络
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-Axi

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?


You need to specify which are the y-axes:

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号