Multiple y-axis in CorePlot

What I'm trying to do using CorePlot on an 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 on the right.

The documentation gives a hint that it should be possible, but I have no idea how to implement it.

I tried the following but failed:

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 is 3 x-Axis.

Any idea how I could do this?

+4
source share
1 answer

You need to specify which y axis:

 leftY.coordinate = CPCoordinateY; rightY.coordinate = CPCoordinateY; 
+5
source

Source: https://habr.com/ru/post/1333172/


All Articles