开发者

Add second plot space/axis to core-plot

开发者 https://www.devze.com 2023-03-17 12:22 出处:网络
Here is my code: CPTXYPlotSpace *barGraphPlotSpace = [[CPTXYPlotSpace alloc] init]; barGraphPlotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(0.0) length:CPDecimalFromFloat(1

Here is my code:

CPTXYPlotSpace *barGraphPlotSpace = [[CPTXYPlotSpace alloc] init];
barGraphPlotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(0.0) length:CPDecimalFromFloat(100.0)];

CPTXYAxis *rightY = [[CPTXYAxis alloc] init];
rightY.coordinate = CPTCoordinateY;
rightY.orthogo开发者_高级运维nalCoordinateDecimal = CPTDecimalFromFloat(oneDay*7);

rightY.plotSpace = barGraphPlotSpace;

[graph addPlotSpace:barGraphPlotSpace];

This doesn't add another axis to my graph though.

What I'm trying to do is get a second y axis which will go from 0-100 (percent). To do this I'm creating a new plot space and a new y axis adding the new plot space to the y axis and adding the plot space to the graph.

What am I doing wrong?

Thank you.


You need to add the new axis to the graph:

NSMutableArray *newAxes = [graph.axisSet.axes mutableCopy];
[newAxes addObject:rightY];
graph.axisSet.axes = newAxes;
[newAxes release];
0

精彩评论

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

关注公众号