Class ChartZoomPanBehavior
ChartZoomPanBehavior enables zooming and panning operations over a Chart.
Implements
Inherited Members
Namespace: Syncfusion.UI.Xaml.Charts
Assembly: Syncfusion.SfChart.UWP.dll
Syntax
public class ChartZoomPanBehavior : ChartBehavior, ICloneable
Remarks
Zooming and panning operations can be initiated and can be restored backed to the original position by performing zoom out operation or by enabling ResetOnDoubleTap property.
Chart can also be zoomed, without adding ChartZoomPanBehavior, by specifying following properties ZoomFactor and ZoomPosition for the ChartAxis. By specifying zooming mode using ZoomMode property, zooming operation can be performed along horizontal or along vertical or along both directions in a Chart.
Examples
This example, we are using ChartZoomPanBehavior.
<syncfusion:SfChart>
<syncfusion:SfChart.Behaviors>
<syncfusion:ChartZoomPanBehavior/>
</syncfusion:SfChart.Behaviors>
</syncfusion:SfChart>
ChartZoomPanBehavior zoomPanBehavior = new ChartZoomPanBehavior();
chartArea.Behaviors.Add(zoomPanBehavior);
Constructors
ChartZoomPanBehavior()
Called when instance created for ChartZoomPanBehavior.
Declaration
public ChartZoomPanBehavior()
Fields
EnableDirectionalZoomingProperty
The DependencyProperty for EnableDirectionalZooming property.
Declaration
public static readonly DependencyProperty EnableDirectionalZoomingProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
EnableMouseWheelZoomingProperty
The DependencyProperty for EnableMouseWheelZooming property.
Declaration
public static readonly DependencyProperty EnableMouseWheelZoomingProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
EnablePanningProperty
The DependencyProperty for EnablePanning property.
Declaration
public static readonly DependencyProperty EnablePanningProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
EnablePinchZoomingProperty
The DependencyProperty for EnablePinchZooming property.
Declaration
public static readonly DependencyProperty EnablePinchZoomingProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
EnableSelectionZoomingProperty
The DependencyProperty for EnableSelectionZooming property.
Declaration
public static readonly DependencyProperty EnableSelectionZoomingProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
EnableZoomingToolBarProperty
The DependencyProperty for EnableZoomingToolBar property.
Declaration
public static readonly DependencyProperty EnableZoomingToolBarProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
FillProperty
The DependencyProperty for Fill property.
Declaration
public static readonly DependencyProperty FillProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
HorizontalPositionProperty
The DependencyProperty for HorizontalPosition property.
Declaration
public static readonly DependencyProperty HorizontalPositionProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
KeyModifiersProperty
The DependencyProperty for KeyModifiers property.
Declaration
public static readonly DependencyProperty KeyModifiersProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
MaximumZoomLevelProperty
The DependencyProperty for MaximumZoomLevel property.
Declaration
public static readonly DependencyProperty MaximumZoomLevelProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
ResetOnDoubleTapProperty
The DependencyProperty for ResetOnDoubleTap property.
Declaration
public static readonly DependencyProperty ResetOnDoubleTapProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
StrokeProperty
The DependencyProperty for Stroke property.
Declaration
public static readonly DependencyProperty StrokeProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
StrokeThicknessProperty
The DependencyProperty for StrokeThickness property.
Declaration
public static readonly DependencyProperty StrokeThicknessProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
ToolBarBackgroundProperty
The DependencyProperty for ToolBarBackground property.
Declaration
public static readonly DependencyProperty ToolBarBackgroundProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
ToolBarItemHeightProperty
The DependencyProperty for ToolBarItemHeight property.
Declaration
public static readonly DependencyProperty ToolBarItemHeightProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
ToolBarItemMarginProperty
The DependencyProperty for ToolBarItemMargin property.
Declaration
public static readonly DependencyProperty ToolBarItemMarginProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
ToolBarItemsProperty
The DependencyProperty for ToolBarItems property.
Declaration
public static readonly DependencyProperty ToolBarItemsProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
ToolBarItemWidthProperty
The DependencyProperty for ToolBarItemWidth property.
Declaration
public static readonly DependencyProperty ToolBarItemWidthProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
ToolBarOrientationProperty
The DependencyProperty for ToolBarOrientation property.
Declaration
public static readonly DependencyProperty ToolBarOrientationProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
VerticalPositionProperty
The DependencyProperty for VerticalPosition property.
Declaration
public static readonly DependencyProperty VerticalPositionProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
ZoomModeProperty
The DependencyProperty for ZoomMode property.
Declaration
public static readonly DependencyProperty ZoomModeProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
ZoomRelativeToCursorProperty
The DependencyProperty for ZoomRelativeToCursor property.
Declaration
public static readonly DependencyProperty ZoomRelativeToCursorProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
Properties
EnableDirectionalZooming
Gets or sets the value that indicates whether directional zooming is enabled.
Declaration
public bool EnableDirectionalZooming { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
If this property is false, zooming is performed based on ZoomMode property. If this property is true, zooming is performed based on pinch direction of the user.
This property having effect only with ZoomMode value as XY
.
EnableMouseWheelZooming
Gets or sets a value indicating whether mouse wheel zooming is enabled.
Declaration
public bool EnableMouseWheelZooming { get; set; }
Property Value
Type |
---|
System.Boolean |
EnablePanning
Gets or sets a value indicating whether to enable/disable the panning.
Declaration
public bool EnablePanning { get; set; }
Property Value
Type |
---|
System.Boolean |
EnablePinchZooming
Gets or sets a value that indicates whether the finger gesture is enabled.
Declaration
public bool EnablePinchZooming { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | This property takes the boolean value, and its default value is true. |
Remarks
If this property is true, zooming is performed based on pinch gesture of the user. If this property is false, zooming is performed based on the mouse wheel of the user.
EnableSelectionZooming
Gets or sets a value indicating whether to enable zooming chart using selection rectangle.
Declaration
public bool EnableSelectionZooming { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableZoomingToolBar
Gets or sets a value indicating whether to show/hide the zooming tool bar.
Declaration
public bool EnableZoomingToolBar { get; set; }
Property Value
Type |
---|
System.Boolean |
Fill
Gets or sets the background for selection rectangle.
Declaration
public Brush Fill { get; set; }
Property Value
Type | Description |
---|---|
Windows.UI.Xaml.Media.Brush | The Windows.UI.Xaml.Media.Brush value. |
HorizontalPosition
Gets or sets the horizontal position for the tool bar.
Declaration
public HorizontalAlignment HorizontalPosition { get; set; }
Property Value
Type |
---|
Windows.UI.Xaml.HorizontalAlignment |
KeyModifiers
Gets or sets the key modifiers used for zooming.
Declaration
public VirtualKeyModifiers KeyModifiers { get; set; }
Property Value
Type |
---|
Windows.System.VirtualKeyModifiers |
MaximumZoomLevel
Gets or sets maximum zoom level of chart area.
Declaration
public double MaximumZoomLevel { get; set; }
Property Value
Type |
---|
System.Double |
ResetOnDoubleTap
Gets or sets a value indicating whether to reset the zooming when press the mouse left button twice.
Declaration
public bool ResetOnDoubleTap { get; set; }
Property Value
Type |
---|
System.Boolean |
Stroke
Gets or sets stroke for selection rectangle.
Declaration
public Brush Stroke { get; set; }
Property Value
Type | Description |
---|---|
Windows.UI.Xaml.Media.Brush | The Windows.UI.Xaml.Media.Brush value. |
StrokeThickness
Gets or sets stroke thickness for selection rectangle.
Declaration
public double StrokeThickness { get; set; }
Property Value
Type |
---|
System.Double |
ToolBarBackground
Gets or sets the tool bar background.
Declaration
public SolidColorBrush ToolBarBackground { get; set; }
Property Value
Type |
---|
Windows.UI.Xaml.Media.SolidColorBrush |
ToolBarItemHeight
Gets or sets the Height for the ZoomingToolBar items.
Declaration
public double ToolBarItemHeight { get; set; }
Property Value
Type |
---|
System.Double |
ToolBarItemMargin
Gets or sets the Margin for the ZoomingToolBar items.
Declaration
public Thickness ToolBarItemMargin { get; set; }
Property Value
Type |
---|
Windows.UI.Xaml.Thickness |
ToolBarItems
Gets or sets a value which is used to select the tool bar items respectively.
Declaration
public ZoomToolBarItems ToolBarItems { get; set; }
Property Value
Type |
---|
ZoomToolBarItems |
ToolBarItemWidth
Gets or sets the width for the ZoomingToolBar items.
Declaration
public double ToolBarItemWidth { get; set; }
Property Value
Type |
---|
System.Double |
ToolBarOrientation
Gets or sets the tool bar orientation.
Declaration
public Orientation ToolBarOrientation { get; set; }
Property Value
Type |
---|
Windows.UI.Xaml.Controls.Orientation |
VerticalPosition
Gets or sets the vertical position for the tool bar.
Declaration
public VerticalAlignment VerticalPosition { get; set; }
Property Value
Type |
---|
Windows.UI.Xaml.VerticalAlignment |
ZoomMode
Gets or sets the mode of zooming.
Declaration
public ZoomMode ZoomMode { get; set; }
Property Value
Type | Description |
---|---|
ZoomMode |
ZoomRelativeToCursor
Gets or sets a value indicating whether zoom relative to mouse pointer and this is applicable only for mouse wheel zooming.
Declaration
public bool ZoomRelativeToCursor { get; set; }
Property Value
Type |
---|
System.Boolean |
Methods
AddZoomingToolBar()
Added zooming tool bar when EnableZoomingToolBar was true.
Declaration
protected void AddZoomingToolBar()
AttachElements()
Method implementation for AttachElements.
Declaration
protected override void AttachElements()
Overrides
CloneBehavior(DependencyObject)
Declaration
protected override DependencyObject CloneBehavior(DependencyObject obj)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.DependencyObject | obj |
Returns
Type |
---|
Windows.UI.Xaml.DependencyObject |
Overrides
DetachElements()
Method implementation for detatch elements.
Declaration
protected override void DetachElements()
Overrides
OnDoubleTapped(DoubleTappedRoutedEventArgs)
Method implementation for OnDoubleTapped.
Declaration
protected override void OnDoubleTapped(DoubleTappedRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Input.DoubleTappedRoutedEventArgs | e | DoubleTappedRoutedEventArgs |
Overrides
OnLayoutUpdated()
Called when layout updated.
Declaration
protected override void OnLayoutUpdated()
Overrides
OnManipulationCompleted(ManipulationCompletedRoutedEventArgs)
Called when manipulation completed in the chart.
Declaration
protected override void OnManipulationCompleted(ManipulationCompletedRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs | e | Which indicates Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs |
Overrides
OnManipulationDelta(ManipulationDeltaRoutedEventArgs)
Called when manipulation delta is changed in chart.
Declaration
protected override void OnManipulationDelta(ManipulationDeltaRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs | e | ManipulationDeltaRoutedEventArgs |
Overrides
OnManipulationStarted(ManipulationStartedRoutedEventArgs)
Called when manipulation started.
Declaration
protected override void OnManipulationStarted(ManipulationStartedRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Input.ManipulationStartedRoutedEventArgs | e | ManipulationStartedRoutedEventArgs |
Overrides
OnPointerMoved(PointerRoutedEventArgs)
Called when pointer moved in the chart.
Declaration
protected override void OnPointerMoved(PointerRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | PointerRoutedEventArgs |
Overrides
OnPointerPressed(PointerRoutedEventArgs)
Called when pointer pressed in chart.
Declaration
protected override void OnPointerPressed(PointerRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | PointerRoutedEventArgs |
Overrides
OnPointerReleased(PointerRoutedEventArgs)
Called when pointer released in the chart.
Declaration
protected override void OnPointerReleased(PointerRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | PointerRoutedEventArgs |
Overrides
OnPointerWheelChanged(PointerRoutedEventArgs)
Occurs when pointer wheel changed in the chart.
Declaration
protected override void OnPointerWheelChanged(PointerRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | PointerRoutedEventArgs |
Overrides
RemoveZoomingToolBar()
Remove zooming tool bar when EnableZoomingToolBar was changed.
Declaration
protected void RemoveZoomingToolBar()
Reset()
Resets the zoom factor and zoom position for all the axis.
Declaration
public void Reset()
Zoom(Double, ChartAxisBase2D)
Zooms the specified cumulative scale.
Declaration
public bool Zoom(double cumulativeScale, ChartAxisBase2D axis)
Parameters
Type | Name | Description |
---|---|---|
System.Double | cumulativeScale | The cumulative scale. |
ChartAxisBase2D | axis | The axis. |
Returns
Type |
---|
System.Boolean |
Zoom(Double, Double, ChartAxisBase2D)
Return bool value from the given ChartAxis.
Declaration
public virtual bool Zoom(double cumulativeScale, double origin, ChartAxisBase2D axis)
Parameters
Type | Name | Description |
---|---|---|
System.Double | cumulativeScale | CumulativeScale value |
System.Double | origin | Origin value |
ChartAxisBase2D | axis | chart axis |
Returns
Type |
---|
System.Boolean |