如何在散点图中隐藏负面部分

时间:2014-04-21 11:24:29

标签: ios objective-c core-plot scatter-plot

我有如下图所示的散点图我必须删除这个散点图的负面部分我尝试使用

x.orthogonalCoordinateDecimal = CPTDecimalFromString(@"0");

但它正在抛出error property 'orthogonalCoordinateDecimal' not found on object 'x'。我的代码片段如下

CPTXYAxisSet *axisSet = (CPTXYAxisSet *) self.hostView.hostedGraph.axisSet;

// Configure x-axis

CPTAxis *x = axisSet.xAxis;
x.title = @"";
x.titleTextStyle = axisTitleStyle;
x.titleOffset = 0.0f;
x.axisLineStyle = axisLineStyle;
x.labelingPolicy = CPTAxisLabelingPolicyNone;
x.labelTextStyle = axisTextStyle;
x.majorTickLineStyle = axisLineStyle;
x.majorTickLength = 4.0f;
x.majorGridLineStyle=gridLineStyle;
x.tickDirection = CPTSignNegative;

enter image description here

1 个答案:

答案 0 :(得分:0)

我使用此设置来限制轴范围。它也可能对你有帮助。

    CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)barChart.defaultPlotSpace;
    [plotSpace setYRange:[CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(0.0f) length:CPTDecimalFromFloat(500.0f)]];
    [plotSpace setXRange:[CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(0.0f) length:CPTDecimalFromFloat(12.0f)]];