WPF Charting Documentation - SciChart WPF Charts SDK v5.x
RubberBandXyZoomModifier

The RubberBandXyZoomModifier provides zooming via drag rectangle on the SciChartSurface.

Declaring a RubberBandXyZoomModifier in XAML

Declaring a RubberBandXyZoomModifier
Copy Code
<!-- where xmlns:s="http://schemas.abtsoftware.co.uk/SciChart" -->
<s:SciChartSurface>
   <s:SciChartSurface.ChartModifier>
      <s:ModifierGroup>
            <s:RubberBandXyZoomModifier IsAnimated="True" IsXAxisOnly="False"/>
         </s:ModifierGroup>
   </s:SciChartSurface.ChartModifier>
</s:SciChartSurface>

Declaring a RubberBandXyZoomModifier in Code

Declaring a RubberBandXyZoomModifier
Copy Code
var sciChartSurface = new SciChartSurface();
sciChartSurface.ChartModifier = new ModifierGroup(new RubberBandXyZoomModifier());

Key Properties of the RubberBandXyZoomModifier

The key properties of the RubberBandXyZoomModifier are shown below:

Key Properties of the RubberBandXyZoomModifier
Copy Code
/// <summary>
/// The <see cref="RubberBandXyZoomModifier"/> provides a mouse drag to zoom into a rectangular region, or horizontal section of the chart.
/// Add to a <see cref="SciChartSurface"/> and set IsEnabled to true to enable this behaviour
/// </summary>
public class RubberBandXyZoomModifier : ChartModifierBase
{
   /// <summary>
   /// Gets or sets whether zoom operations should be animated. Default true
   /// </summary>
   public bool IsAnimatedProperty = DependencyProperty.Register(...);

   /// <summary>
   /// Gets or sets the Fill brush of the reticule drawn on the screen as the user zooms
   /// </summary>
   public Brush RubberBandFillProperty = DependencyProperty.Register(...);

   /// <summary>
   /// Gets or sets the Stroke brush of the reticule drawn on the screen as the user zooms
   /// </summary>
   public Brush RubberBandStrokeProperty = DependencyProperty.Register(...);


   /// <summary>
   /// Gets or sets the StrokeDashArray, used to set a dashed outline for the rubber band rectangle.
   /// See the <see cref="Shape.StrokeDashArray"/> property for usage
   /// </summary>
   public DoubleCollection RubberBandStrokeDashArrayProperty =   
                           DependencyProperty.Register(...);

   /// <summary>
   /// Gets or sets whether the RubberBand should zoom the X-Axis only.
   /// If true, then the effect will be instead of a rectangle drawn under the mouse, an horizontal section of the
   /// entire chart will be selected
   /// </summary>
   public bool IsXAxisOnlyProperty = DependencyProperty.Register(...);

   /// <summary>
   /// If true, zooms to extents on the Y-Axis on each zoom operation. Use in conjuction with <see cref="RubberBandXyZoomModifier.IsXAxisOnly"/> to achieve different zooming effects
   /// </summary>
   public bool ZoomExtentsYProperty = DependencyProperty.Register(...);

   /// <summary>
   /// Gets or sets the drag sensitivity - rectangles dragged smaller than this size in the diagonal will be ignored when zooming. Default is 10 pixels
   /// </summary>
   public double MinDragSensitivityProperty = DependencyProperty.Register(...);

   /// <summary>
   /// Determines when the <see cref="RubberBandXyZoomModifier"/> executes,
   /// e.g. <see cref="ChartModifiers.ExecuteOn.MouseLeftButton"/> will cause a
   /// zoom on left-mouse drag click of the parent <see cref="SciChartSurface"/>
   /// </summary>
   public ExecuteOn ExecuteOnProperty = DependencyProperty.Register(...);

    // ...   
}

 

Styling the Drag-Zoom Reticule

The drag-reticule can be styled via the RubberBandFillRubberBandStrokeRubberBandStrokeDashArray properties.

The RubberBandXyZoomModifier is also theme aware, and picks up the IThemeProvider keys RubberBandFill and RubberBandStrokeBrush.

 

See Also

 

 


SCICHART ® is a Registered Trademark in the UK, US and EEC. Copyright SciChart Ltd 2011-2018.

Email us to give feedback!