Core Plot图底部轴不可见

时间:2013-08-07 15:36:56

标签: ios objective-c core-plot

我有一个核心情节线图,显示如下(为清晰起见,背景视图为红色):

enter image description here

我底部有0个填充,我有一个带有标签的x轴。尽管如此,图表仍被挤压在视图的底部。如果我增加底部填充,我会在底部得到一个灰色条,结果相同。

为了从图表底部向上移动图形并显示轴,我需要更改什么?

代码很冗长,但这里有一些摘录:

    self->graph = [[CPTXYGraph alloc] initWithFrame:hostView.bounds];
    hostView.hostedGraph = graph;
    self->graph.paddingLeft = 0.0f;
    self->graph.paddingTop = 10.0f;
    self->graph.paddingRight = 0.0f;
    self->graph.paddingBottom = 0.0f;

    ...

    [plotSpace scaleToFitPlots:[NSArray arrayWithObjects:p1, p2, p3, nil]];
    CPTMutablePlotRange *xRange = [plotSpace.xRange mutableCopy];
    [xRange expandRangeByFactor:CPTDecimalFromCGFloat(1.1f)];
    plotSpace.xRange = xRange;
    CPTMutablePlotRange *yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(0.0f) length:CPTDecimalFromFloat(500.0f)];
    plotSpace.yRange = yRange;

    ...

    CPTXYAxisSet *axisSet = (CPTXYAxisSet *) self->graph.axisSet;
    CPTAxis *x = axisSet.xAxis;
    x.axisLineStyle = axisLineStyle;
    x.labelingPolicy = CPTAxisLabelingPolicyNone;
    x.majorTickLineStyle = axisLineStyle;
    x.majorTickLength = 4.0f;
    x.tickDirection = CPTSignNegative;

    ...

    x.axisLabels = xLabels;
    x.majorTickLocations = xLocations;

1 个答案:

答案 0 :(得分:2)

尝试将底部填充添加到graph.plotAreaFrame