0
votes

I have line graph and bar graph using core plot framework. In that graphs it won't starts from origin. see this image graph image

In that image x-axis and y-axis had started from (-2,-50). I don't want to show negative x-axis and y-axis.

CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet;
axisSet.xAxis.orthogonalCoordinateDecimal = CPTDecimalFromFloat(1.0);  // or whatever
axisSet.yAxis.orthogonalCoordinateDecimal = CPTDecimalFromFloat(1.0); 

I tried the above code. If i used that it won't shows the values in x-axis and y-axis. How do i solve this? Thanks in advance!

2

2 Answers

2
votes

Use axisSet.xAxis.visibleRange to set your graphs x axis visible range and yAxis for the y axis.

1
votes

exact code is given below

axisSet.xAxis.visibleRange =  [CPTPlotRange plotRangeWithLocation:CPTDecimalFromInteger(0) length:CPTDecimalFromInteger(31)];
axisSet.yAxis.visibleRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromInteger(0) length:CPTDecimalFromInteger(10)];

Here in x-axis 31 is the last plotted value of x-axis. In y-axis upto 10 the axis must be shown.