Reputation: 1
I am new to coreplot. I would like to insert a horizontal scroll bar on my application in order to move my graph. I don't know how do to this. I find some code on internet like this:
-(IBAction)moveLineLocation:(id)sender {
CPPlotRange *rangeX = plotSpace.xRange;
CPPlotRange *rangeY = plotSpace.yRange;
rangeX.location = CPDecimalAdd(rangeX.location, CPDecimalFromFloat(-0.5));
plotSpace.xRange = rangeX;
plotSpace.yRange = rangeY;
[graph.axisSet relabelAxes];
[graph reloadData];
}
But it's not working. Do you have any hint,idea please
Regards
Upvotes: 0
Views: 331
Reputation: 10285
You can make the Graph scroll without scrollbars:
plotSpace.allowsUserInteraction = YES;
plotSpace.globalYRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(-5f) length:CPDecimalFromFloat(5)];
plotSpace.globalXRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(-5f) length:CPDecimalFromFloat(5)];
Those ranges are the limits of the scrolling. Make the Y range equal to your graph range to remove scrolling on the Y axis.
Upvotes: 1