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.WPF.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:ChartZoomPanBehaviorgt;
</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
Declaration
protected ChartAxis chartAxis
Field Value
Type | Description |
---|---|
ChartAxis |
Properties
AdorningCanvas
Gets the top layer Canvas.
Declaration
public Canvas AdorningCanvas { get; }
Property Value
Type | Description |
---|---|
System.Windows.Controls.Canvas |
BottomAdorningCanvas
Gets the bottom layer Canvas.
Declaration
public Canvas BottomAdorningCanvas { get; }
Property Value
Type | Description |
---|---|
System.Windows.Controls.Canvas |
ChartArea
Gets the owner Chart
Declaration
public SfChart ChartArea { get; }
Property Value
Type | Description |
---|---|
SfChart |
Methods
AlignDefaultLabel(ChartAlignment, ChartAlignment, Double, Double, ContentControl)
Declaration
protected virtual void AlignDefaultLabel(ChartAlignment verticalAlignemnt, ChartAlignment horizontalAlignment, double x, double y, ContentControl control)
Parameters
Type | Name | Description |
---|---|---|
ChartAlignment | verticalAlignemnt | |
ChartAlignment | horizontalAlignment | |
System.Double | x | |
System.Double | y | |
System.Windows.Controls.ContentControl | control |
AttachElements()
Method implementation for AttachElements
Declaration
protected virtual void AttachElements()
Clone()
Returns the clone behavior
Declaration
public DependencyObject Clone()
Returns
Type | Description |
---|---|
System.Windows.DependencyObject |
CloneBehavior(DependencyObject)
Declaration
protected virtual DependencyObject CloneBehavior(DependencyObject obj)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | obj |
Returns
Type | Description |
---|---|
System.Windows.DependencyObject |
DetachElement(UIElement)
Method implementation for DetachElement
Declaration
protected virtual void DetachElement(UIElement element)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.UIElement | element |
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 | |
ChartSeriesBase | series |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<System.Double> |
OnDoubleTapped(MouseButtonEventArgs)
Method implementation for OnDoubleTapped
Declaration
protected virtual void OnDoubleTapped(MouseButtonEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseButtonEventArgs | e |
OnDragEnter(DragEventArgs)
Called when Drag action enter into the ChartArea
Declaration
protected virtual void OnDragEnter(DragEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DragEventArgs | e |
OnDragLeave(DragEventArgs)
Called when Drag action leave from the area
Declaration
protected virtual void OnDragLeave(DragEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DragEventArgs | e |
OnDragOver(DragEventArgs)
Called when Drag action over in the Area
Declaration
protected virtual void OnDragOver(DragEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DragEventArgs | e |
OnDrop(DragEventArgs)
Called when drop the cursor in ChartArea
Declaration
protected virtual void OnDrop(DragEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DragEventArgs | e |
OnGotFocus(RoutedEventArgs)
Called when GotFocus in UIElement
Declaration
protected virtual void OnGotFocus(RoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.RoutedEventArgs | e |
OnKeyDown(KeyEventArgs)
Called when pointer key down in ChartArea
Declaration
protected virtual void OnKeyDown(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.KeyEventArgs | e |
OnKeyUp(KeyEventArgs)
Called when Pointer key up in Chart
Declaration
protected virtual void OnKeyUp(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.KeyEventArgs | e |
OnLayoutUpdated()
Called when layout updated
Declaration
protected virtual void OnLayoutUpdated()
OnLostFocus(RoutedEventArgs)
Called when Lost the focus in Chart
Declaration
protected virtual void OnLostFocus(RoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.RoutedEventArgs | e |
OnManipulationCompleted(ManipulationCompletedEventArgs)
Called when ManipulationCompleted
Declaration
protected virtual void OnManipulationCompleted(ManipulationCompletedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.ManipulationCompletedEventArgs | e |
OnManipulationDelta(ManipulationDeltaEventArgs)
Called when ManipulationDelta is changed
Declaration
protected virtual void OnManipulationDelta(ManipulationDeltaEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.ManipulationDeltaEventArgs | e |
OnManipulationStarted(ManipulationStartedEventArgs)
Called when ManipulationStarted
Declaration
protected virtual void OnManipulationStarted(ManipulationStartedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.ManipulationStartedEventArgs | e |
OnMouseEnter(MouseEventArgs)
Called when MouseEnter in to Chart
Declaration
protected virtual void OnMouseEnter(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseEventArgs | e |
OnMouseLeave(MouseEventArgs)
Called when MouseLeave from Chart
Declaration
protected virtual void OnMouseLeave(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseEventArgs | e |
OnMouseLeftButtonDown(MouseButtonEventArgs)
Called when MouseLeftButtonDown in Chart
Declaration
protected virtual void OnMouseLeftButtonDown(MouseButtonEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseButtonEventArgs | e |
OnMouseLeftButtonUp(MouseButtonEventArgs)
Called when OnMouse
Declaration
protected virtual void OnMouseLeftButtonUp(MouseButtonEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseButtonEventArgs | e |
OnMouseMove(MouseEventArgs)
Called when MouseMove in chart
Declaration
protected virtual void OnMouseMove(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseEventArgs | e |
OnMouseWheel(MouseWheelEventArgs)
Called when MouseWheel on Chart
Declaration
protected virtual void OnMouseWheel(MouseWheelEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseWheelEventArgs | e |
OnSizeChanged(SizeChangedEventArgs)
Called when Size Changed
Declaration
protected virtual void OnSizeChanged(SizeChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.SizeChangedEventArgs | e |
UpdateArea()
Method implementation for UpdateArea in Chart
Declaration
protected void UpdateArea()