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。