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

The ZoomPanModifier provides dragging the SciChartSurface to pan the chart.

Declaring a ZoomPanModifier in XAML

Declaring a ZoomPanModifier
Copy Code
<!-- where xmlns:s="http://schemas.abtsoftware.co.uk/SciChart" -->
<s:SciChartSurface>
   <s:SciChartSurface.ChartModifier>
      <s:ModifierGroup>
            <s:ZoomPanModifier XyDirection="XyDirection" ClipModeX="None"
                               ZoomExtentsY="False"/>
         </s:ModifierGroup>
   </s:SciChartSurface.ChartModifier>
</s:SciChartSurface>

Declaring a ZoomPanModifier in Code

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

Key Properties of the ZoomPanModifier

The key Dependency Properties of the ZoomPanModifier are listed below:

Key Properties of the ZoomPanModifier
Copy Code
/// <summary>
/// The <see cref="ZoomPanModifier"/> provides a mouse drag to pan the X and Y axes.
/// Add to a <see cref="SciChartSurface"/> and set IsEnabled to true to enable this behaviour
/// </summary>
public class ZoomPanModifier : ZoomPanModifierBase
{
   /// <summary>
   /// If true, zooms to extents on the Y-Axis on each zoom operation when panning in
   /// X-Direction. Use in conjuction with <see cref="ZoomPanModifierBase.XyDirection"/>
   /// to achieve different zooming effects
   /// </summary>
   public static bool ZoomExtentsYProperty = DependencyProperty.Register(...);
  
   /// <summary>
   /// Defines the direction of the ZoomPanModifier
   /// </summary>
   public XyDirection XyDirectionProperty = DependencyProperty.Register(...);

   /// <summary>
   /// Defines how panning behaves when you reach the edge of the X-Axis extents.
   /// e.g. ClipMode.ClipAtExtents prevents panning outside of the X-Axis,
   /// ClipMode.None allows panning outside
   /// </summary>
   public ClipMode ClipModeXProperty = DependencyProperty.Register(...);

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

   // …
}

 

Excluding one or more Axis from a ZoomPanModifier Pan Operation

It is possible to exclude one or more axis from a ZoomPanModifier Pan operation using the Attached Property ZoomPanModifier.IncludeAxis. By default this property is true (all axis are panned).

To enable or disable this on a per-axis basis, use the following code:

XAML
Excluding one or more Axis from a ZoomPanModifier Pan Operation
Copy Code
<!-- where xmlns:s="http://schemas.abtsoftware.co.uk/SciChart" -->
<s:SciChartSurface>

   <s:SciChartSurface.YAxes>
      <s:NumericAxis />   
      <s:NumericAxis Id="SecondaryYAxis" s:ZoomPanModifier.IncludeAxis="False"/>
   </s:SciChartSurface.YAxes>
  
   <s:SciChartSurface.XAxis>
      <s:NumericAxis />
   </s:SciChartSurface.XAxis>
  
   <s:SciChartSurface.ChartModifier>
      <s:ModifierGroup>
         <s:ZoomPanModifier ClipModeX="None"/>
      </s:ModifierGroup>
   </s:SciChartSurface.ChartModifier>
</s:SciChartSurface>
CODE
Excluding one or more Axis from a ZoomPanModifier Pan Operation
Copy Code
var axis = new NumericAxis();
ZoomPanModifier.SetIncludeAxis(axis, false);

See Also

 

 


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

Email us to give feedback!