Class ChartBehavior
ChartBehavior is an abstract base class for behaviors which can be added to SfChart
Inheritance
Implements
Namespace: Syncfusion.UI.Xaml.Charts
Assembly: Syncfusion.SfChart.UWP.dll
Syntax
public abstract class ChartBehavior : DependencyObject, ICloneable
Remarks
You can handle the SfChart events directly in Chart behavior, which will be helpful in designing the Chart application in MVVM pattern. You can add a custom behavior to the SfChart by inheriting a class from the ChartBehavior. You can also add ui elements to the Chart by making use of the top layer canvas returned from AdorningCanvas property,which can be used to place the ui elements at desired positions in SfChart.
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
ChartBehavior()
Called when instance created for ChartBehavior.
Declaration
public ChartBehavior()
Fields
chartAxis
Used to specify corresponding ChartAxis.
Declaration
protected ChartAxis chartAxis
Field Value
| Type |
|---|
| ChartAxis |
Properties
AdorningCanvas
Gets the top layer Canvas.
Declaration
public Canvas AdorningCanvas { get; }
Property Value
| Type |
|---|
| Windows.UI.Xaml.Controls.Canvas |
BottomAdorningCanvas
Gets the bottom layer Canvas.
Declaration
public Canvas BottomAdorningCanvas { get; }
Property Value
| Type |
|---|
| Windows.UI.Xaml.Controls.Canvas |
ChartArea
Gets the owner Chart.
Declaration
public SfChart ChartArea { get; }
Property Value
| Type |
|---|
| SfChart |
Methods
AlignDefaultLabel(ChartAlignment, ChartAlignment, Double, Double, ContentControl)
Align the element inside the content control.
Declaration
protected virtual void AlignDefaultLabel(ChartAlignment verticalAlignemnt, ChartAlignment horizontalAlignment, double x, double y, ContentControl control)
Parameters
| Type | Name | Description |
|---|---|---|
| ChartAlignment | verticalAlignemnt | Used to specify ChartAlignment for vertical |
| ChartAlignment | horizontalAlignment | Used to specify ChartAlignment for horizontal |
| System.Double | x | The X location |
| System.Double | y | The Y location |
| Windows.UI.Xaml.Controls.ContentControl | control | Used to specify corresponding content control |
AttachElements()
Method implementation for attach elements.
Declaration
protected virtual void AttachElements()
Clone()
Returns the clone behavior.
Declaration
public DependencyObject Clone()
Returns
| Type |
|---|
| Windows.UI.Xaml.DependencyObject |
CloneBehavior(DependencyObject)
Declaration
protected virtual DependencyObject CloneBehavior(DependencyObject obj)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.DependencyObject | obj |
Returns
| Type |
|---|
| Windows.UI.Xaml.DependencyObject |
DetachElement(UIElement)
Method implementation for DetachElement.
Declaration
protected virtual void DetachElement(UIElement element)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.UIElement | element | UIElement |
DetachElements()
Method implementation for DetachElements.
Declaration
protected virtual void DetachElements()
GetYValuesBasedOnIndex(Double, ChartSeriesBase)
Return collection of double values from the given ChartSeries.
Declaration
protected IList<double> GetYValuesBasedOnIndex(double x, ChartSeriesBase series)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | x | x-position |
| ChartSeriesBase | series | ChartSeriesBase |
Returns
| Type |
|---|
| System.Collections.Generic.IList<System.Double> |
OnDoubleTapped(DoubleTappedRoutedEventArgs)
Method implementation for OnDoubleTapped.
Declaration
protected virtual void OnDoubleTapped(DoubleTappedRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.DoubleTappedRoutedEventArgs | e | DoubleTappedRoutedEventArgs |
OnDragEnter(DragEventArgs)
Called when drag action enter into the chart area.
Declaration
protected virtual void OnDragEnter(DragEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.DragEventArgs | e | DragEventArgs |
OnDragLeave(DragEventArgs)
Called when drag action leave from the chart area.
Declaration
protected virtual void OnDragLeave(DragEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.DragEventArgs | e | DragEventArgs |
OnDragOver(DragEventArgs)
Called when drag action over in the chart area.
Declaration
protected virtual void OnDragOver(DragEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.DragEventArgs | e | DragEventArgs |
OnDrop(DragEventArgs)
Called when drop the cursor in the chart area.
Declaration
protected virtual void OnDrop(DragEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.DragEventArgs | e | DragEventArgs |
OnGotFocus(RoutedEventArgs)
Called when got focus in UIElement.
Declaration
protected virtual void OnGotFocus(RoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.RoutedEventArgs | e | RoutedEventArgs |
OnHolding(HoldingRoutedEventArgs)
Called when holding the focus in UIElement.
Declaration
protected virtual void OnHolding(HoldingRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.HoldingRoutedEventArgs | e | HoldingRoutedEventArgs |
OnKeyDown(KeyRoutedEventArgs)
Called when KeyDown in the chart.
Declaration
protected virtual void OnKeyDown(KeyRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.KeyRoutedEventArgs | e | KeyRoutedEventArgs |
OnKeyUp(KeyRoutedEventArgs)
Called when KeyUp in the chart.
Declaration
protected virtual void OnKeyUp(KeyRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.KeyRoutedEventArgs | e | KeyRoutedEventArgs |
OnLayoutUpdated()
Called when layout updated.
Declaration
protected virtual void OnLayoutUpdated()
OnLostFocus(RoutedEventArgs)
Called when lost the focus in the chart.
Declaration
protected virtual void OnLostFocus(RoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.RoutedEventArgs | e | RoutedEventArgs |
OnManipulationCompleted(ManipulationCompletedRoutedEventArgs)
Called when manipulation completed in the chart.
Declaration
protected virtual void OnManipulationCompleted(ManipulationCompletedRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs | e | ManipulationCompletedRoutedEventArgs |
OnManipulationDelta(ManipulationDeltaRoutedEventArgs)
Called when manipulation delta is changed in the chart.
Declaration
protected virtual void OnManipulationDelta(ManipulationDeltaRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs | e | ManipulationDeltaRoutedEventArgs |
OnManipulationInertiaStarting(ManipulationInertiaStartingRoutedEventArgs)
Called when manipulation action start in the chart.
Declaration
protected virtual void OnManipulationInertiaStarting(ManipulationInertiaStartingRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.ManipulationInertiaStartingRoutedEventArgs | e | ManipulationInertiaStartingRoutedEventArgs |
OnManipulationStarted(ManipulationStartedRoutedEventArgs)
Called when manipulation started.
Declaration
protected virtual void OnManipulationStarted(ManipulationStartedRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.ManipulationStartedRoutedEventArgs | e | ManipulationStartedRoutedEventArgs |
OnManipulationStarting(ManipulationStartingRoutedEventArgs)
Called when manipulation starting.
Declaration
protected virtual void OnManipulationStarting(ManipulationStartingRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.ManipulationStartingRoutedEventArgs | e | ManipulationStartingRoutedEventArgs |
OnPointerCanceled(PointerRoutedEventArgs)
Called when pointer cancelled in the chart.
Declaration
protected virtual void OnPointerCanceled(PointerRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | PointerRoutedEventArgs |
OnPointerCaptureLost(PointerRoutedEventArgs)
Called when pointer capture lost in the chart.
Declaration
protected virtual void OnPointerCaptureLost(PointerRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | PointerRoutedEventArgs |
OnPointerEntered(PointerRoutedEventArgs)
Called when pointer entered in the chart.
Declaration
protected virtual void OnPointerEntered(PointerRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | PointerRoutedEventArgs |
OnPointerExited(PointerRoutedEventArgs)
Called when pointer exited in the chart.
Declaration
protected virtual void OnPointerExited(PointerRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | PointerRoutedEventArgs |
OnPointerMoved(PointerRoutedEventArgs)
Called when pointer moved in the chart.
Declaration
protected virtual void OnPointerMoved(PointerRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | PointerRoutedEventArgs |
OnPointerPressed(PointerRoutedEventArgs)
Called when pointer pressed in the chart.
Declaration
protected virtual void OnPointerPressed(PointerRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | PointerRoutedEventArgs |
OnPointerReleased(PointerRoutedEventArgs)
Called when pointer released in the chart.
Declaration
protected virtual void OnPointerReleased(PointerRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | PointerRoutedEventArgs |
OnPointerWheelChanged(PointerRoutedEventArgs)
Called when pointer wheel changed.
Declaration
protected virtual void OnPointerWheelChanged(PointerRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | PointerRoutedEventArgs |
OnRightTapped(RightTappedRoutedEventArgs)
Called when right tapped on the chart.
Declaration
protected virtual void OnRightTapped(RightTappedRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.RightTappedRoutedEventArgs | e | RightTappedRoutedEventArgs |
OnSizeChanged(SizeChangedEventArgs)
Called when size changed.
Declaration
protected virtual void OnSizeChanged(SizeChangedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.SizeChangedEventArgs | e | SizeChangedEventArgs |
OnTapped(TappedRoutedEventArgs)
Called when tapped the chart.
Declaration
protected virtual void OnTapped(TappedRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Windows.UI.Xaml.Input.TappedRoutedEventArgs | e | TappedRoutedEventArgs |
UpdateArea()
This method used to update the entire chart by recalculating and redrawing it.
Declaration
protected void UpdateArea()