Question

I'm trying to come up with a scatter plot whose range depends on the value received. The given variable self.xAxisMinimum takes in the first value of the data received. However when I run my program it reads such that, when self.xAxisMinimum = 4688 the plotspace.range starts from 5000. Given below is the plotspace settings.

CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)self.graph.defaultPlotSpace;
plotSpace.xRange = [CPTPlotRange       

plotRangeWithLocation:CPTDecimalFromFloat(self.xAxisMinimum - 100)  length:CPTDecimalFromFloat(60*60)];

plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(yAxisMin) length:CPTDecimalFromFloat(yAxisMax - yAxisMin)];

Is it anything related to the the major interval length? I have major interval length of 180seconds. Give below is the code for the Xaxis-set's parameters.

axisSet.xAxis.title = @"Time(per sec)";
axisSet.xAxis.titleTextStyle = textStyle;
axisSet.xAxis.axisLineStyle = lineStyle;
axisSet.xAxis.titleOffset = 30.0f;
axisSet.xAxis.majorTickLineStyle = lineStyle;
axisSet.xAxis.minorTickLineStyle = lineStyle;
axisSet.xAxis.majorGridLineStyle = lineStyle;
axisSet.xAxis.minorGridLineStyle=gridStyle;
axisSet.xAxis.labelOffset = 6.0f;
axisSet.xAxis.majorIntervalLength = CPTDecimalFromFloat(180.0f);
axisSet.xAxis.minorTicksPerInterval = 5;
axisSet.xAxis.minorTickLength = 0.50f;
axisSet.xAxis.majorTickLength = 0.50f;
axisSet.xAxis.labelTextStyle = textStyle;
axisSet.xAxis.labelFormatter = formatter;

So for this set up I should have had a x axis starting from (4688-100) instead of 5000. Anyone have any idea why? thanks much in advance

Was it helpful?

Solution

the issue lies in DecimalFromFloat. I gave an integer input to the float value and converted into decimal. Instead I changed to DecimalFromInteger. It works fine. Thanks

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top