I want to do the following: http://youtu.be/PeRhxSCx2xM
I am trying to implement this method:
//viewDidLoad //plotSpace.delegate = self; - (CPTPlotRange *)plotSpace:(CPTPlotSpace *)space willChangePlotRangeTo:(CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate { NSLog(@"WillChangePlotRangeTo"); // only allows scrolling to the right // remove this to have scrolling in both directions if (newRange.locationDouble < 0.0F) { newRange.location = CPTDecimalFromFloat(0.0); } // Adjust axis to keep them in view at the left and bottom; // adjust scale-labels to match the scroll. CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet; if (coordinate == CPTCoordinateX) { axisSet.yAxis.orthogonalCoordinateDecimal = newRange.location; axisSet.xAxis.titleLocation = CPTDecimalFromFloat(newRange.locationDouble + (newRange.lengthDouble / 2.0F)); } else { axisSet.xAxis.orthogonalCoordinateDecimal = newRange.location; axisSet.yAxis.titleLocation = CPTDecimalFromFloat(newRange.locationDouble + (newRange.lengthDouble / 2.0F)); } return newRange; }
And I'm trying to do this, this solution works when I zoom out, but it doesn't work when I zoom out.
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(1.0) length:CPTDecimalFromFloat(3.0)]; plotSpace.globalYRange = plotSpace.yRange;
someone please explain to me what the correct result is and how its work really is.
Thanks answers
source share