核心图:y轴标签应从60开始

时间:2013-09-13 11:40:17

标签: ios core-plot scatter-plot

我需要绘制一个散点图,其中x轴应该与y轴在(0,60)处相交。 我还需要y轴上的间隔为20。

我现在面临的问题是:

  1. y轴从0开始
  2. y轴标签之间的差距示例,从60 - 80过多。
  3. 到目前为止我做了什么:

    设置交叉点:

      
        
          
            

    x.orthogonalCoordinateDecimal = CPTDecimalFromString(@“60”);

          
        
      

    设置主要刻度位置:

    NSSet *majorTickLocations = [NSSet setWithObjects:[NSDecimalNumber zero],
         [NSDecimalNumber numberWithUnsignedInteger:60],
         [NSDecimalNumber numberWithUnsignedInteger:80],
         [NSDecimalNumber numberWithUnsignedInteger:100],
         [NSDecimalNumber numberWithUnsignedInteger:120],
         nil];
    
    y.majorTickLocations = majorTickLocations;
    

    方向上的任何指针都会有所帮助。

    此致 依禅

1 个答案:

答案 0 :(得分:2)

要使轴交叉(0,60),设置每个轴的orthogonalCoordinateDecimal

x.orthogonalCoordinateDecimal = CPTDecimalFromDouble(60.0);
y.orthogonalCoordinateDecimal = CPTDecimalFromDouble(0.0);

轴标签政策确定刻度线和标签的定位方式。如果您自己提供刻度和标签位置(CPTAxisLabelingPolicyNone),您可以将它们放在任何您想要的位置。请参阅"轴标签政策"在 Plot Gallery 示例应用程序中演示每个可用标签政策的样本。

相关问题