核心图中x轴刻度之间的距离

时间:2012-06-02 07:45:30

标签: iphone cocoa-touch core-plot

自昨天以来我一直在打破这个问题(尝试了各种属性设置,goggled,stackoverflow'ed等等......徒劳)。最后,我决定发布这个!我希望不要问任何愚蠢的事!请原谅我! :)

我的项目设置: 简单的iPhone应用程序,使用Core Plot,Xcode 4.2,iOS 5.0, 使用iOS模拟器进行测试

我的问题:我使用Core Plot网站上的精彩和DatePlot示例,并沿着x轴绘制(散点图)日期。我有两个阴谋。这一切都很好(感谢简单的例子!);但是每个图(沿着x轴)之间的距离,即主要刻度之间的距离太小......就像这样:

enter image description here

(请注意,两个红色的椭圆形图彼此非常接近......这是刻度线之间的当前距离)

我的代码片段(相关)

//设置轴     CPTXYAxisSet * axisSet =(CPTXYAxisSet *)lineChart.axisSet;

CPTXYAxis *x                    = axisSet.xAxis;
NSTimeInterval oneDay   = 24.0 * 60.0 * 60.0;
x.majorIntervalLength           = CPTDecimalFromFloat(oneDay);
x.majorTickLength               = 1.0;
// Get a set of custom label for the X Axis
x.axisLabels                    = [self getXLabelSetForLineChart:x];
x.labelRotation                 = M_PI / 2;

NSDateFormatter *dateFormatter   = [[NSDateFormatter alloc] init];
dateFormatter.dateStyle          = kCFDateFormatterShortStyle;
[dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
CPTTimeFormatter *timeFormatter  = [[CPTTimeFormatter alloc] initWithDateFormatter:dateFormatter];
timeFormatter.referenceDate      = today;
x.labelFormatter                 = timeFormatter;
x.labelingPolicy                 = CPTAxisLabelingPolicyNone;

有人可以帮忙!!!

谢谢!

1 个答案:

答案 0 :(得分:4)

地块空间length的{​​{1}}太长了。这会将您的数据点压缩到较小的区域,并将未使用的空格留在右侧。