【发布时间】:2013-02-28 22:09:57
【问题描述】:
我有一个图表区域,我可以在其中选择绘制不同的属性。每个属性都定义了自己的 y 轴范围。下图显示了四舍五入到最近单位的 y 轴标签(看起来不干净)。
如何使 y 轴标签根据所绘制的数据四舍五入到最接近的百万分之一、千分之一或百分之一?
我还认为我可以将 y 轴的下限和上限设置为这些四舍五入的数字,以便我以后可以设置一个偶数增量,从而为我提供那些更好看的标签。我怎样才能得到这些四舍五入的限制?
我现在正在做的设置这些限制如下:
//Look up the absolute minimum and absolute maximum values
NSNumber * min = [allArraysDrawn valueForKeyPath:@"@min.intValue"];
NSNumber * max = [allArraysDrawn valueForKeyPath:@"@max.intValue"];
//Define the limits of the plot area with a cushion both above the max value and below the min value
float yAxisMin = [min floatValue] - (([max floatValue] - [min floatValue]) * 0.05);
float yAxisMax = [max floatValue] + (([max floatValue] - [min floatValue]) * 0.05);
有什么想法吗?谢谢!
【问题讨论】:
标签: objective-c core-plot