views:

52

answers:

1

Hi, I would like to have my user scroll inside a CPXYGraph. I have a CPXYGraph as part of a CPHostingLayer, like in the tutorials. I enabled allowsUserInteraction, which is cool and allows scrolling. But I don't want to allow my user to scroll to 'infinity', which it seems like it allows-you can keep dragging further and further away from where the data is on a plot.

How do I constrain this so that the user can only scroll within a certain bounds?

I also enabled masksToBorder, and set the outerBorderPath and innerBorderPath to something arbitarily small, but I saw no changes, so I am not sure how those are supposed to work.

I could not set maskingPath and subLayerMaskingPath because they seem to be read only(no setters), though i feel like these two properties might be what I am looking for.

Anyone has run into this situation? Would be glad if someone could shed some light. Thanks!

+2  A: 

The masking properties only affect the drawing. You need to use the globalXRange and globalYRange properties of your plot space. These define the maximum range that can be scrolled into view. See the example in CPTestApp.

Eric Skroch
eric, this sounds like exactly what I want. I will verify and let you know as I am away right now. Thanks in advance!
Ying
awesome. works like a charm.
Ying