Pre loader

Only pan when zoomed.

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

I’m trying to accomplish 2 things:

First is that I would like to not be able to zoom out past the data, it does no good to zoom out if there is no more data to see. It would also be nice to have a little bounce/spring back if you zoom to far, like when zooming out on an image on an iPhone.

The second is that I only want to be able to pan to the data. If zoomed all the way out, then trying to pan would do nothing. If zoomed in you should be able to scroll around, but only to the end of the data.

I believe I have the first one accomplished by setting the maximalZoomContrain to be the same as the data range, although this doesn’t allow any kind of bounce.

What need to be done to make this work, this seems like a feature that is built into the SciChart Modifiers.

Version
2.2
  • You must to post comments
0
0

Good morning,

To prevent zooming outside an area in iOS you can use this technique in our iOS Chart Documentation:

Axis Ranging – Restricting VisibleRange

Advanced VisibleRange Clipping

Axis.VisibleRangeLimit is a useful API to ensure the axis clips the VisibleRange when zooming to extents. However, it will not stop a user from scrolling outside of that range. To achieve that, you need a small modification.

To clip the VisibleRange and force a certain maximum or minimum, just use the following code:

// Register a VisibleRangeChanged callback
var helper2: SCICallbackHelper? = axis.registerVisibleRangeChangedCallback({(_ newRange: SCIRangeProtocol, _ oldRange: SCIRangeProtocol, _ isAnimated: Bool, _ sender: Any) -> Void in
        // Set the old range back on the axis if the new range.Min is less than 0
        if SCIGenericDouble(newRange.min) < 0.0 {
            axis.visibleRange = oldRange
        }
    })
// When finished, unsubscribe to the callback
helper2?.remove()

The second question, bounce at the edge of the chart, is not currently supported, however, if you create a feature-request and vote for it, when we get enough votes we will build it!

Best regards,
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.