1
那么我试图通过NSTimeInterval(double)值来管理这个问题。但是,让我们说核心图 - 我们如何在不改变数据绘图值的情况下更改x轴类的长度
X:五月01 2010下午1时03分55秒Y:32
X:05月2010下午7时02分55秒Y:20
现在,如果尝试显示当天明智的节目准确的结果。我的代码段是
xRange=[CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(min) length:CPDecimalFromFloat(maxValue-min)];
xClassLength=[[NSString alloc]initWithFormat:@"%f",length]; //length=1
//here the max & min values are NSTimeInterval
CPXYAxis *x2 = [[(CPXYAxis *)[CPXYAxis alloc] initWithFrame:CGRectZero] autorelease];
x2.labelingPolicy = CPAxisLabelingPolicyAutomatic;
x2.orthogonalCoordinateDecimal=CPDecimalFromInteger(startPointY);
x2.minorTicksPerInterval = 0;
x2.majorTickLength=[xClassLength intValue];
x2.preferredNumberOfMajorTicks = 5;
x2.labelOffset = 10.0;
x2.coordinate = CPCoordinateX;
x2.plotSpace = graph.defaultPlotSpace;
x2.axisLineStyle = redLineStyle;
x2.majorTickLineStyle = redLineStyle;
x2.labelingPolicy=CPAxisLabelingPolicyAutomatic;
CPTimeFormatter *timeFormatter = [[[CPTimeFormatter alloc] initWithDateFormatter:xDateFormatter] autorelease];
timeFormatter.referenceDate = refDate; //refDate=May 01 2010 12:00 PM
x2.labelFormatter=timeFormatter;
x2.labelTextStyle=axisTitleTextStyle;
x2.visibleRange =xRange;
CPConstraints x2Constraints = {CPConstraintFixed, CPConstraintNone};
x2.isFloatingAxis = YES;
x2.constraints = x2Constraints;
//结束的代码 那么这里我感到困惑的是,如果我想表现出同样的数据,但与X级长度不同;让说3小时。我应该在哪里做出改变。 请指导我一样。 关于Zahur。