iPhone - 核心图,手动滚动 CPscatterPlot
我想在我的代码中手动滚动 CPscatterPlot
。我可以滚动绘图区域,但在滚动时 globalXRange & globalYRange 无法正常工作。我可以(手动,通过单击按钮)滚动到图表之外。我想限制滚动区域,一旦达到全局范围。
这是我正在使用的代码,
-(IBAction)moveLineLocation:(id)sender {
isButtonClicked = TRUE;
currentTag = [sender tag];
CPPlotRange *rangeX = plotSpace.xRange;
CPPlotRange *rangeY = plotSpace.yRange;
if([sender tag] == 1) {
rangeX.location = CPDecimalAdd(rangeX.location, CPDecimalFromFloat(-0.5));
}
else if([sender tag] == 2) {
rangeY.location = CPDecimalAdd(rangeY.location, CPDecimalFromFloat(0.5));
}
else if([sender tag] == 3) {
rangeX.location = CPDecimalAdd(rangeX.location, CPDecimalFromFloat(0.5));
}
else {
rangeY.location = CPDecimalAdd(rangeY.location, CPDecimalFromFloat(-0.5));
}
plotSpace.xRange = rangeX;
plotSpace.yRange = rangeY;
[graph.axisSet relabelAxes];
[graph reloadData];
}
我如何限制这个问题?
PS-触摸事件globalXRange & globalYRange
工作得非常完美。
谢谢
Pratik
I want to scroll CPScatterPlot
manually in my code. I am able to scroll plot area but while scrolling globalXRange & globalYRange
not working properly. I can scroll (manually, with button click) beyond the graph. I want to restrict scroll area, once it reaches to global range.
Here is the code I am using,
-(IBAction)moveLineLocation:(id)sender {
isButtonClicked = TRUE;
currentTag = [sender tag];
CPPlotRange *rangeX = plotSpace.xRange;
CPPlotRange *rangeY = plotSpace.yRange;
if([sender tag] == 1) {
rangeX.location = CPDecimalAdd(rangeX.location, CPDecimalFromFloat(-0.5));
}
else if([sender tag] == 2) {
rangeY.location = CPDecimalAdd(rangeY.location, CPDecimalFromFloat(0.5));
}
else if([sender tag] == 3) {
rangeX.location = CPDecimalAdd(rangeX.location, CPDecimalFromFloat(0.5));
}
else {
rangeY.location = CPDecimalAdd(rangeY.location, CPDecimalFromFloat(-0.5));
}
plotSpace.xRange = rangeX;
plotSpace.yRange = rangeY;
[graph.axisSet relabelAxes];
[graph reloadData];
}
How can I restrict come over from this problem?
P.S- In touch events globalXRange & globalYRange
are working absolutely perfect.
Thanks
Pratik
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在修改绘图范围之前先复制它们:
Make a copy of the plot ranges before you modify them: