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!
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With