Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Coreplot plot space range - iOS

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

like image 344
DesperateLearner Avatar asked Jul 19 '26 08:07

DesperateLearner


1 Answers

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

like image 110
DesperateLearner Avatar answered Jul 20 '26 20:07

DesperateLearner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!