Class ChartZoomPanBehavior
ChartZoomPanBehavior enables zooming and panning operations over a Chart.
Implements
Inherited Members
Namespace: Syncfusion.UI.Xaml.Charts
Assembly: Syncfusion.SfChart.WPF.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 |
---|
System.Windows.DependencyProperty |
EnableMouseWheelZoomingProperty
The DependencyProperty for EnableMouseWheelZooming property.
Declaration
public static readonly DependencyProperty EnableMouseWheelZoomingProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
EnablePanningProperty
The DependencyProperty for EnablePanning property.
Declaration
public static readonly DependencyProperty EnablePanningProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
EnablePinchZoomingProperty
The DependencyProperty for EnablePinchZooming property.
Declaration
public static readonly DependencyProperty EnablePinchZoomingProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
EnableSelectionZoomingProperty
The DependencyProperty for EnableSelectionZooming property.
Declaration
public static readonly DependencyProperty EnableSelectionZoomingProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
EnableZoomingToolBarProperty
The DependencyProperty for EnableZoomingToolBar property.
Declaration
public static readonly DependencyProperty EnableZoomingToolBarProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
FillProperty
The DependencyProperty for Fill property.
Declaration
public static readonly DependencyProperty FillProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
HorizontalPositionProperty
The DependencyProperty for HorizontalPosition property.
Declaration
public static readonly DependencyProperty HorizontalPositionProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
MaximumZoomLevelProperty
The DependencyProperty for MaximumZoomLevel property.
Declaration
public static readonly DependencyProperty MaximumZoomLevelProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ResetOnDoubleTapProperty
The DependencyProperty for ResetOnDoubleTap property.
Declaration
public static readonly DependencyProperty ResetOnDoubleTapProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
StrokeProperty
The DependencyProperty for Stroke property.
Declaration
public static readonly DependencyProperty StrokeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
StrokeThicknessProperty
The DependencyProperty for StrokeThickness property.
Declaration
public static readonly DependencyProperty StrokeThicknessProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ToolBarBackgroundProperty
The DependencyProperty for ToolBarBackground property.
Declaration
public static readonly DependencyProperty ToolBarBackgroundProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ToolBarItemHeightProperty
The DependencyProperty for ToolBarItemHeight property.
Declaration
public static readonly DependencyProperty ToolBarItemHeightProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ToolBarItemMarginProperty
The DependencyProperty for ToolBarItemMargin property.
Declaration
public static readonly DependencyProperty ToolBarItemMarginProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ToolBarItemsProperty
The DependencyProperty for ToolBarItems property.
Declaration
public static readonly DependencyProperty ToolBarItemsProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ToolBarItemWidthProperty
The DependencyProperty for ToolBarItemWidth property.
Declaration
public static readonly DependencyProperty ToolBarItemWidthProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ToolBarOrientationProperty
The DependencyProperty for ToolBarOrientation property.
Declaration
public static readonly DependencyProperty ToolBarOrientationProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
VerticalPositionProperty
The DependencyProperty for VerticalPosition property.
Declaration
public static readonly DependencyProperty VerticalPositionProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ZoomModeProperty
The DependencyProperty for ZoomMode property.
Declaration
public static readonly DependencyProperty ZoomModeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ZoomRelativeToCursorProperty
The DependencyProperty for ZoomRelativeToCursor property.
Declaration
public static readonly DependencyProperty ZoomRelativeToCursorProperty
Field Value
Type |
---|
System.Windows.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 |
---|---|
System.Windows.Media.Brush | The System.Windows.Media.Brush value. |
HorizontalPosition
Gets or sets the horizontal position for the tool bar.
Declaration
public HorizontalAlignment HorizontalPosition { get; set; }
Property Value
Type |
---|
System.Windows.HorizontalAlignment |
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 |
---|---|
System.Windows.Media.Brush | The System.Windows.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 |
---|
System.Windows.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 |
---|
System.Windows.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 |
---|
System.Windows.Controls.Orientation |
VerticalPosition
Gets or sets the vertical position for the tool bar.
Declaration
public VerticalAlignment VerticalPosition { get; set; }
Property Value
Type |
---|
System.Windows.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 |
---|---|---|
System.Windows.DependencyObject | obj |
Returns
Type |
---|
System.Windows.DependencyObject |
Overrides
DetachElements()
Method implementation for detatch elements.
Declaration
protected override void DetachElements()
Overrides
OnLayoutUpdated()
Called when layout updated.
Declaration
protected override void OnLayoutUpdated()
Overrides
OnManipulationCompleted(ManipulationCompletedEventArgs)
Declaration
protected override void OnManipulationCompleted(ManipulationCompletedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.ManipulationCompletedEventArgs | e |
Overrides
OnManipulationDelta(ManipulationDeltaEventArgs)
Called when ManipulationDelta is changed.
Declaration
protected override void OnManipulationDelta(ManipulationDeltaEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.ManipulationDeltaEventArgs | e | ManipulationDeltaEventArgs |
Overrides
OnManipulationStarted(ManipulationStartedEventArgs)
Called when ManipulationStarted.
Declaration
protected override void OnManipulationStarted(ManipulationStartedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.ManipulationStartedEventArgs | e | ManipulationStartedEventArgs |
Overrides
OnMouseLeave(MouseEventArgs)
Called when mouse leaved from the chart.
Declaration
protected override void OnMouseLeave(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseEventArgs | e | MouseEventArgs |
Overrides
OnMouseLeftButtonDown(MouseButtonEventArgs)
Called when mouse left button is clicked.
Declaration
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseButtonEventArgs | e | MouseButtonEventArgs |
Overrides
OnMouseLeftButtonUp(MouseButtonEventArgs)
Called when mouse left button was released.
Declaration
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseButtonEventArgs | e | MouseButtonEventArgs |
Overrides
OnMouseMove(MouseEventArgs)
Called when mouse moved in the chart.
Declaration
protected override void OnMouseMove(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseEventArgs | e | MouseEventArgs |
Overrides
OnMouseWheel(MouseWheelEventArgs)
Declaration
protected override void OnMouseWheel(MouseWheelEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseWheelEventArgs | e |
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 |