Class ChartZoomPanBehavior
This class is used to enable zooming feature in SfChart. An instance of this class need to be added to ChartBehaviors collection.
Inherited Members
Namespace: Syncfusion.SfChart.XForms
Assembly: Syncfusion.SfChart.XForms.dll
Syntax
public class ChartZoomPanBehavior : ChartBehavior, IThemeElement
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 EnableDoubleTap property. Chart can also be zoomed, without adding ChartZoomPanBehavior, by specifying following properties ChartAxis.ZoomFactor and ChartAxis.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
SfChart chart = new SfChart();
ChartZoomPanBehavior zoomPan = new ChartZoomPanBehavior();
chart.ChartBehaviors.Add(zoomPan);
Constructors
ChartZoomPanBehavior()
Declaration
public ChartZoomPanBehavior()
Fields
EnableDirectionalZoomingProperty
Gets or sets a value indicating whether directional zooming is enabled. This is a bindable property.
Declaration
public static readonly BindableProperty EnableDirectionalZoomingProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
EnableDoubleTapProperty
Gets or sets the value that indicates whether to zoom the chart on double tap. This is a bindable property.
Declaration
public static readonly BindableProperty EnableDoubleTapProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
EnablePanningProperty
Gets or sets the value that indicates whether to allow panning in the chart, when it is in zoomed state. This is a bindable property.
Declaration
public static readonly BindableProperty EnablePanningProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
EnableSelectionZoomingProperty
Gets or sets the value that indicates whether box selection zooming is enabled. This is a bindable property.
Declaration
public static readonly BindableProperty EnableSelectionZoomingProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
EnableZoomingProperty
Gets or sets the value that indicates whether to allow zooming in chart. This is a bindable property.
Declaration
public static readonly BindableProperty EnableZoomingProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
MaximumZoomLevelProperty
Gets or sets the value that determines the maximum zoom level of the chart. This is a bindable property.
Declaration
public static readonly BindableProperty MaximumZoomLevelProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
SelectionRectFillColorProperty
Gets or sets the fill color of the selection rectangle. This is a bindable property.
Declaration
public static readonly BindableProperty SelectionRectFillColorProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
SelectionRectStrokeColorProperty
Gets or sets the stroke color of the selection rectangle. This is a bindable property.
Declaration
public static readonly BindableProperty SelectionRectStrokeColorProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
SelectionRectStrokeDashArrayProperty
Gets or sets the dash array for the border of the selection rectangle. This is a bindable property.
Declaration
public static readonly BindableProperty SelectionRectStrokeDashArrayProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
SelectionRectStrokeWidthProperty
Gets or sets the stroke width of the selection rectangle. This is a bindable property.
Declaration
public static readonly BindableProperty SelectionRectStrokeWidthProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
ZoomModeProperty
Gets or sets the mode that indicates whether to zooming can be carried out in X, Y and XY axis. This is a bindable property.
Declaration
public static readonly BindableProperty ZoomModeProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
Properties
EnableDirectionalZooming
Gets or sets a value indicating whether directional zooming is enabled. This is a bindable property.
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
.
This property does not expose in MacOS platform.
EnableDoubleTap
Gets or sets a value indicating whether to zoom the chart on double tap. This is a bindable property.
Declaration
public bool EnableDoubleTap { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | This property takes the boolean value. |
EnablePanning
Gets or sets a value indicating whether to allow panning in the chart, when it is in zoomed state. This is a bindable property.
Declaration
public bool EnablePanning { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | This property takes the boolean value. |
EnableSelectionZooming
Gets or sets a value indicating whether box selection zooming is enabled. This is a bindable property.
Declaration
public bool EnableSelectionZooming { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | This property takes the boolean value. |
EnableZooming
Gets or sets a value indicating whether to allow zooming in chart. This is a bindable property.
Declaration
public bool EnableZooming { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | This property take |
MaximumZoomLevel
Gets or sets the value that determines the maximum zoom level of the chart. This is a bindable property.
Declaration
public float MaximumZoomLevel { get; set; }
Property Value
Type | Description |
---|---|
System.Single | This property takes the float value. |
SelectionRectFillColor
Gets or sets the fill color of the selection rectangle. This is a bindable property.
Declaration
public Color SelectionRectFillColor { get; set; }
Property Value
Type | Description |
---|---|
Xamarin.Forms.Color | This property takes the Color value. |
SelectionRectStrokeColor
Gets or sets the stroke color of the selection rectangle. This is a bindable property.
Declaration
public Color SelectionRectStrokeColor { get; set; }
Property Value
Type | Description |
---|---|
Xamarin.Forms.Color | This property takes the Color value. |
SelectionRectStrokeDashArray
Gets or sets the dash array for the border of the selection rectangle. This is a bindable property.
Declaration
public double[] SelectionRectStrokeDashArray { get; set; }
Property Value
Type | Description |
---|---|
System.Double[] | This property takes the double array as its value. |
SelectionRectStrokeWidth
Gets or sets the stroke width of the selection rectangle. This is a bindable property.
Declaration
public float SelectionRectStrokeWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Single | This property takes the float value. |
ZoomMode
Gets or sets the mode that indicates whether to zooming can be carried out in X, Y and XY axis. This is a bindable property.
Declaration
public ZoomMode ZoomMode { get; set; }
Property Value
Type | Description |
---|---|
ZoomMode | This property takes the boolean value. |
Methods
OnScaleDelta(Single, Single, Single)
Called when screen have indicated a new focal point and/or scale with specified x, y and factor.
Declaration
protected virtual void OnScaleDelta(float manipulationX, float manipulationY, float scaleFactor)
Parameters
Type | Name | Description |
---|---|---|
System.Single | manipulationX | manipulationX. |
System.Single | manipulationY | manipulationY. |
System.Single | scaleFactor | scale factor. |
OnScaleEnd(Single, Single, Single)
Called when pointers are no longer in contact with the screen.
Declaration
protected virtual void OnScaleEnd(float manipulationX, float manipulationY, float scaleFactor)
Parameters
Type | Name | Description |
---|---|---|
System.Single | manipulationX | manipulationX. |
System.Single | manipulationY | manipulationY. |
System.Single | scaleFactor | scale factor. |
OnScaleStart(Single, Single, Single)
Called when screen have established a focal point from initial scale of 1.0.
Declaration
protected virtual void OnScaleStart(float manipulationX, float manipulationY, float scaleFactor)
Parameters
Type | Name | Description |
---|---|---|
System.Single | manipulationX | manipulationX. |
System.Single | manipulationY | manipulationY. |
System.Single | scaleFactor | scale factor. |
OnScroll(Single, Single, Single, Single)
Raises the Scroll event.
Declaration
protected virtual void OnScroll(float pointX, float pointY, float distanceX, float distanceY)
Parameters
Type | Name | Description |
---|---|---|
System.Single | pointX | point x. |
System.Single | pointY | point y. |
System.Single | distanceX | distance x. |
System.Single | distanceY | distance y. |
Reset()
Resets the zoom level for all the axis.
Declaration
public void Reset()
Zoom(ChartAxis, Single, Single)
Zooms the given axis to the specified level and origin.
Declaration
public void Zoom(ChartAxis chartAxis, float cumulativeLevel, float origin)
Parameters
Type | Name | Description |
---|---|---|
ChartAxis | chartAxis | ChartAxis. |
System.Single | cumulativeLevel | CumulativeLevel. |
System.Single | origin | Origin. |
Zoom(Rect)
Zooms the chart to the given rectangle in the plot area.
Declaration
public void Zoom(Rect zoomRect)
Parameters
Type | Name | Description |
---|---|---|
Rect | zoomRect | Rectangle. |
Zoom(Double)
Changes the zoom level to the specified zoom factor.
Declaration
public void Zoom(double zoomFactor)
Parameters
Type | Name | Description |
---|---|---|
System.Double | zoomFactor | ZoomFactor. |
ZoomByRange(ChartAxis, Double, Double)
Zooms the given axis to the given range.
Declaration
public void ZoomByRange(ChartAxis chartAxis, double start, double end)
Parameters
Type | Name | Description |
---|---|---|
ChartAxis | chartAxis | ChartAxis. |
System.Double | start | StartRange. |
System.Double | end | EndRange. |
ZoomByRange(DateTimeAxis, DateTime, DateTime)
Zooms the given axis to the given date time range.
Declaration
public void ZoomByRange(DateTimeAxis dateTimeAxis, DateTime start, DateTime end)
Parameters
Type | Name | Description |
---|---|---|
DateTimeAxis | dateTimeAxis | DateTimeAxis. |
System.DateTime | start | StartRange. |
System.DateTime | end | EndRange. |
ZoomIn()
Increases the centralization zoom level in plot area.
Declaration
public void ZoomIn()
ZoomOut()
Decreases the centralization zoom level in plot area.
Declaration
public void ZoomOut()
ZoomToFactor(ChartAxis, Double, Double)
Changes the zoom level to given zoom factor.
Declaration
public void ZoomToFactor(ChartAxis chartAxis, double zoomPosition, double zoomFactor)
Parameters
Type | Name | Description |
---|---|---|
ChartAxis | chartAxis | ChartAxis. |
System.Double | zoomPosition | ZoomPosition. |
System.Double | zoomFactor | ZoomFactor. |