轴绘制在核心图中的图下 [英] the axis is drawn under the plot in core plot

查看:71
本文介绍了轴绘制在核心图中的图下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个图,除了x轴和y轴,我想向该图添加两个蓝色轴.但是,这些蓝色轴出现在曲线图下方.知道如何将蓝轴置于情节顶部吗?预先谢谢你.

I have a graph, and I want to add two blue axes to this graph, in addition to x-axis and y-axis. However, these blue axes appear under the plot. Any idea how to bring the blue axes on 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;

推荐答案

而不是使用轴在绘图上绘制线,而应使用其他绘图.如果它们使用相同的线型,则可以使用相同的图形绘制两条线.将蓝色绘图添加到图形之后,将绿色绘图添加到图形上方.

Instead using axes to draw lines across the plot, use additional plots. You can draw both lines with the same plot if they use the same line style. Add the blue plot to the graph after the green one to have it drawn on top.

这篇关于轴绘制在核心图中的图下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆