CPTScatterPlotInterpolationCurved 越界无法确定比例

CPTScatterPlotInterpolationCurved going out of bounds unable to determine scale

我已经确定了一些灵活的方法来确定图表和轴的大小,但我对 CPTScatterPlotInterpolationCurved 有疑问,因为它可能高于提供的最大数据(无法轻松计算)。

有没有属性或者方法可以return插值后的最大值?

这里的例子(看上面的剪裁@绿色刻度)

计算边界的代码:

// Setup scatter plot space
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)self.graph.defaultPlotSpace;

CGFloat margin = [[self.dataArray valueForKeyPath:@"@max.floatValue"] integerValue]*0.10;

double xLow = 0.0f;
double yHigh = 0;
double yLow = 0;
double xHigh = [self drawnDataTilPlot:self.graph.allPlots.lastObject] + [self.dividedDataArray.lastObject count]-1;

if (round([[self.dataArray valueForKeyPath:@"@max.floatValue"] integerValue]/10)*10 < [[self.dataArray valueForKeyPath:@"@max.floatValue"] integerValue]) {
    yHigh = [[self.dataArray valueForKeyPath:@"@max.floatValue"] integerValue] + margin;
}
else {
    yHigh = round([[self.dataArray valueForKeyPath:@"@max.floatValue"] integerValue]/10)*10+margin;
}
if (self.type == GRChartTypeScatterLine) {
    yLow = [[self.dataArray valueForKeyPath:@"@min.floatValue"] integerValue];
    yLow -= margin*0.5;
    yHigh -= yLow;
}

plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(xLow) length:CPTDecimalFromFloat(xHigh)];

if ([[self.dataArray valueForKeyPath:@"@max.integerValue"]integerValue]==0 &&
    [[self.dataArray valueForKeyPath:@"@min.integerValue"]integerValue]==0){
    plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(-1) length:CPTDecimalFromFloat(2)];
}
else {
    plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(yLow) length:CPTDecimalFromFloat(yHigh)];
}

目前没有任何方法可以做到这一点。请参阅 issue 131 上的评论,了解一种可能的解决方法。