The axis is drawn according to the graph in a curve
I have a graph and I want to add two blue axes to this graph, in addition to the x-axis and the y-axis. However, these blue axes appear below the plot. Any idea how to get the blue axes over the top of the plot? Thank you in advance.

blueAxisList = [[NSMutableDictionary alloc] init];
CPTXYAxis *blueAxis = [blueAxisList objectForKey:name];
blueAxis = [[CPTXYAxis alloc] init];
blueAxis.coordinate = CPTCoordinateX;
blueAxis.plotSpace = plotSpace;
CPTMutableLineStyle *lineStyle = [CPTMutableLineStyle lineStyle];
lineStyle.lineWidth = 3.f;
blueAxis.axisLineStyle = lineStyle;
blueAxis.minorTickLineStyle = nil;
blueAxis.majorTickLineStyle = nil;
blueAxis.labelingPolicy = CPTAxisLabelingPolicyNone;
// Line cap on lhs
CPTLineCap *lineCap = [CPTLineCap lineCap];
lineCap.size = CGSizeMake(8., 60.);
lineCap.lineStyle = lineStyle;
lineCap.lineCapType = CPTLineCapTypeRectangle;
const double axisLength = plotSpace.xRange.lengthDouble;
blueAxis.visibleAxisRange = [CPTPlotRange plotRangeWithLocation:plotSpace.xRange.location length:CPTDecimalFromDouble(axisLength)];
blueAxis.axisLineCapMax = lineCap;
NSMutableArray *axesList= [graph.axisSet.axes mutableCopy];
[axesList addObject: blueAxis];
graph.axisSet.axes = axesList;
0
Pegah
source
to share
1 answer
Instead of using axes to draw lines around the plot, use additional graphs. You can draw both lines with the same plot as long as they use the same line style. Add a blue graph to the graph after the green one so that it is drawn on top.
0
Eric Skroch
source
to share