SciChart iOS v2.x API > Axis APIs > Axis APIs - Programmatically Zoom, Scroll
Axis APIs - Programmatically Zoom, Scroll

Programmatically Scrolling an Axis

SciChart provides a clean and simple API to interact with a single Axis programmatically, e.g. to Zoom, Scroll or Pan an axis. This can come in useful when creating custom ChartModifierBase derived classes e.g. custom zooming or panning of the chart.

Axis Interactivity Methods

The following methods can be found on SCIAxis2DProtocol and SCIAxisBase, a shared base-class for Axis types in SciChart.

Using these methods you can programmatically zoom, scroll (pan) a specific axis. Use this to create custom gestures in your chart.

/**
 * Scrolls current VisibleRange by specified number of pixels
 * @param pixelsToScroll Scroll N pixles from the current visible range
 * @param clipMode Defines how scrolling behaves when you reach the edge of the Axis extents
 * @param duration The duration of animation when zooming to extents
 * @see SCIClipMode
 */
- (void)scrollByPixels:(double)pixelsToScroll ClipMode:(SCIClipMode)clipMode AnimationTime:(float)duration Velocity:(float)velocity;
/**
 * Translates current VisibleRange by specified number of datapoints
 * @param pointAmount Amount of data points that the start visible range is scrolled by
 * @see SCIRange
 */
- (void)scrollByDataPoints:(int)pointAmount;
/**
 * Translates current VisibleRange by specified number of datapoints
 * @param pointAmount Amount of data points that the start visible range is scrolled by
 * @param duration Defines how scrolling behaves when you reach the edge of the Axis extents
 * @see SCIClipMode
 */
- (void)scrollByDataPoints:(int)pointAmount AnimationTime:(float)duration;
/**
 * Performs zoom on current Axis, using fromCoord as a coordinate of new range start and toCoord as a coordinate of new range end
 * @param fromCoord The coordinate of new range start in pixels
 * @param toCoord The coordinate of new range end in pixels
 * @see SCIRange
 */
- (void)zoomFrom:(double)fromCoord To:(double)toCoord;
/**
 * Performs zoom on current Axis, using fromCoord as a coordinate of new range start and toCoord as a coordinate of new range end
 * @param fromCoord The coordinate of new range start in pixels
 * @param toCoord The coordinate of new range end in pixels
 * @param duration The duration of animation when zooming to extents
 * @see SCIRange
 */
- (void)zoomFrom:(double)fromCoord To:(double)toCoord AnimationTime:(float)duration;
/**
 * Performs zoom on current Axis, using minFraction as a multuplier of range start and maxFraction as a multiplier of range end
 * @param minFraction The miltiplier of range start
 * @param maxFraction The miltiplier of range end
 * @see SCIRange
 */
- (void)zoomByFractionMin:(double)minFraction Max:(double)maxFraction;
/**
 * Performs zoom on current Axis, using minFraction as a multuplier of range start and maxFraction as a multiplier of range end
 * @param minFraction The miltiplier of range start
 * @param maxFraction The miltiplier of range end
 * @param duration The duration of animation when zooming to extents
 * @see SCIRange
 */
- (void)zoomByFractionMin:(double)minFraction Max:(double)maxFraction AnimationTime:(float)duration;
/**
 * From the starting SCIRange, scrolls to a new range by the specified number of pixels, with the specified range limit
 * @param pixelsToScroll Scroll N pixels from the start visible range
 * @param startVisibleRange The start visible range
 * @param rangeLimit The range limit
 * @see SCIRange
 */
- (void)scrollToPixels:(double)pixelsToScroll WithVisibleRange:(id <SCIRangeProtocol>)startVisibleRange WithLimit:(id <SCIRangeProtocol>)rangeLimit;

 

The Header Files and Doxygen documentation for SCIAxis2DProtocol can be found here.

In addition, some concrete examples of using the Axis Interactivity API to create custom ChartModifiers can be found in our documentation CustomModifiers - the SCIChartModifierBase API.

 

See Also