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

The XAxisDragModifier allows you to add X-Axis scaling or panning on mouse-drag.

 

Declaring a XAxisDragModifier in XAML

Declaring a XAxisDragModifier
Copy Code
<!-- where xmlns:s="http://schemas.abtsoftware.co.uk/SciChart" -->
<s:SciChartSurface>
   <s:SciChartSurface.ChartModifier>
      <s:ModifierGroup>
         <s:XAxisDragModifier DragMode="Scale"/>
      </s:ModifierGroup>
   </s:SciChartSurface.ChartModifier>
</s:SciChartSurface>

Declaring a XAxisDragModifier in Code

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

Switching from YAxis Drag to Pan Mode

The property XAxisDragModifier.DragMode allows you to switch between Panning and Scaling on drag of an axis.

Allow Zooming or Panning only one XAxis

By default, an XAxisDragModifier is applied to all the axes in the SciChartSurface.XAxes collection. You can apply dragging or zooming to only one axis by setting the XAxisDragModifier.AxisId property:

Allow Zooming or Panning only one XAxis
Copy Code
<!-- where xmlns:s="http://schemas.abtsoftware.co.uk/SciChart" -->
<s:SciChartSurface>

   <s:SciChartSurface.XAxes>
      <s:NumericAxis x:Name="xAxis0" />
      <s:NumericAxis x:Name="xAxis1" Id="SecondaryXAxis"/>
   </s:SciChartSurface.XAxes>
  
   <s:SciChartSurface.ChartModifier>
      <s:ModifierGroup>
              <!-- Set YAxisDragModifier.AxisId = yAxis1.Id -->
              <!-- This will allow dragging on only the secondary y axis -->
         <s:XAxisDragModifier AxisId="{Binding ElementName=xAxis1, Path=Id}"/>
      </s:ModifierGroup>
   </s:SciChartSurface.ChartModifier>
</s:SciChartSurface>

Allow Zooming or Panning all but one XAxis

By default, an XAxisDragModifier is applied to all the axes in the SciChartSurface.XAxes collection. You can exclude one or more XAxis by setting the XAxisDragModifier.IncludeAxis attached property to false.

Allow Zooming or Panning all but one XAxis
Copy Code
<!-- where xmlns:s="http://schemas.abtsoftware.co.uk/SciChart" -->
<s:SciChartSurface>

   <s:SciChartSurface.XAxes>
      <!-- This axis will be excluded from YAxis Dragging -->
      <s:NumericAxis x:Name="xAxis0" XAxisDragModifier.IncludeAxis="False"/>
      <s:NumericAxis x:Name="xAxis1" Id="SecondaryXAxis"/>
   </s:SciChartSurface.YAxes>
  
   <s:SciChartSurface.ChartModifier>
      <s:ModifierGroup>
         <s:XAxisDragModifier/>
      </s:ModifierGroup>
   </s:SciChartSurface.ChartModifier>
</s:SciChartSurface>

See Also

 

 


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

Email us to give feedback!