Well i tried to manage this issue passing the NSTimeInterval(double) values. But let say
X: May 01 2010 01:03:55 PM Y:32
X: May 05 2010 07:02:55 PM Y:20
Now, if try to display the day wise its shows the accurate results. My code snippet is
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;
//End of code Well here i get confused , that if i want to show the same data but with different the X class-length; let say 3 hrs. Where I should make the changes. Please guide me for the same. Regards Zahur.