2010-05-20 7 views
1

글쎄, NSTimeInterval (double) 값을 전달하면서이 문제를 관리하려고했습니다. 월 01 2010 오후 1시 3분 55초 Y : 32
X : 5 월 05 2010 오후 7시 2분 55초의 Y : 20
자, 지혜로운 날을 표시하려고하면 그 쇼 그러나코어 플롯 - 데이터 플롯 값을 변경하지 않고 x 축 클래스 길이를 어떻게 바꿀 수 있습니까?

X를 가정 해 봅시다 정확한 결과. 내 코드는 자, 여기 코드 내가, 혼란의

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 시간을 보자. 내가 어디에서 변화를 만들어야하는지. 동일하게 안내해주세요. 감사합니다.

답변

1

나는 꽤 오래된 게시물을 알고 있습니다. 그래도 이것은 어떤 사람이나 다른 사람에게 도움이 될 수 있습니다. 플롯 범위를 변경하여 언제든지 X 축 길이를 변경할 수 있습니다. 이것은 CorePlot의 예제에있는 CPTestApp-iPhone-SpeedTest에서 잘 설명되어 있습니다.

축의 길이에 대한 값을 변경하면 동일한 그래프가보다 자세하게 또는 그 반대로 표시됩니다.

CPXYPlotSpace *plotSpace = (CPXYPlotSpace *)graph.defaultPlotSpace; 
float ylen = NUM_POINTS*(rand()/(float)RAND_MAX) ; 
plotSpace.xRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(0.0) length:CPDecimalFromFloat(NUM_POINTS)]; 
plotSpace.yRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(0.0) length:CPDecimalFromFloat(ylen)]; 

희망.