Class Annotation
Provides a lightweight control for displaying overlay element in SfChart.
Implements
Namespace: Syncfusion.UI.Xaml.Charts
Assembly: Syncfusion.SfChart.WPF.dll
Syntax
public abstract class Annotation : FrameworkElement, ICloneable
Constructors
Annotation()
Initializes a new instance of the Annotation class.
Declaration
public Annotation()
Fields
ContentTemplateProperty
The DependencyProperty for ContentTemplate property.
Declaration
public static readonly DependencyProperty ContentTemplateProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
CoordinateUnitProperty
The DependencyProperty for CoordinateUnit property.
Declaration
public static readonly DependencyProperty CoordinateUnitProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
EnableClippingProperty
The DependencyProperty for EnableClipping property.
Declaration
public static readonly DependencyProperty EnableClippingProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
EnableEditingProperty
The DependencyProperty for EnableEditing property.
Declaration
public static readonly DependencyProperty EnableEditingProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
FontFamilyProperty
The DependencyProperty for FontFamily property.
Declaration
public static readonly DependencyProperty FontFamilyProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
FontSizeProperty
The DependencyProperty for FontSize property.
Declaration
public static readonly DependencyProperty FontSizeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
FontStretchProperty
The DependencyProperty for FontStretch property.
Declaration
public static readonly DependencyProperty FontStretchProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
FontStyleProperty
The DependencyProperty for FontStyle property.
Declaration
public static readonly DependencyProperty FontStyleProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
FontWeightProperty
The DependencyProperty for FontWeight property.
Declaration
public static readonly DependencyProperty FontWeightProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ForegroundProperty
The DependencyProperty for Foreground property.
Declaration
public static readonly DependencyProperty ForegroundProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ShowToolTipProperty
The DependencyProperty for ShowToolTip property.
Declaration
public static readonly DependencyProperty ShowToolTipProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
TextProperty
The DependencyProperty for Text property.
Declaration
public static readonly DependencyProperty TextProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ToolTipContentProperty
The DependencyProperty for ToolTipContent property.
Declaration
public static readonly DependencyProperty ToolTipContentProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ToolTipPlacementProperty
The DependencyProperty for ToolTipPlacement property.
Declaration
public static readonly DependencyProperty ToolTipPlacementProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ToolTipShowDurationProperty
The DependencyProperty for ToolTipShowDuration property.
Declaration
public static readonly DependencyProperty ToolTipShowDurationProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ToolTipTemplateProperty
The DependencyProperty for ToolTipTemplate property.
Declaration
public static readonly DependencyProperty ToolTipTemplateProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
X1Property
The DependencyProperty for X1 property.
Declaration
public static readonly DependencyProperty X1Property
Field Value
Type |
---|
System.Windows.DependencyProperty |
XAxisNameProperty
The DependencyProperty for XAxisName property.
Declaration
public static readonly DependencyProperty XAxisNameProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Y1Property
The DependencyProperty for Y1 property.
Declaration
public static readonly DependencyProperty Y1Property
Field Value
Type |
---|
System.Windows.DependencyProperty |
YAxisNameProperty
The DependencyProperty for XAxisName property.
Declaration
public static readonly DependencyProperty YAxisNameProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Properties
AnnotationElement
Gets or sets the annotation grid.
Declaration
protected Grid AnnotationElement { get; set; }
Property Value
Type |
---|
System.Windows.Controls.Grid |
ContentTemplate
Gets or sets the custom template for Text.
Declaration
public DataTemplate ContentTemplate { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.DataTemplate | This accepts a DataTemplate. System.Windows.DataTemplate |
Examples
<syncfusion:SfChart.Annotations>
<syncfusion:Annotation ContentTemplate="{StaticResource contentTemplate}">
</syncfusion:SfChart.Annotations>
annotation.ContentTemplate = dataTemplate;
CoordinateUnit
Gets or sets the property which identifies whether the annotation positioned w.r.t pixel or axis coordinate.
Declaration
public CoordinateUnit CoordinateUnit { get; set; }
Property Value
Type | Description |
---|---|
CoordinateUnit | - position the annotation based on screen coordinates.
- position the annotation based on axis values.
|
EnableClipping
Gets or sets a value indicating whether annotation should clip while crossing with boundary.
Declaration
public bool EnableClipping { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableEditing
Gets or sets a value indicating whether the text in TextAnnotation
can be edited or not.
Declaration
public bool EnableEditing { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
FontFamily
Gets or sets the font family for the annotation description.
Declaration
public FontFamily FontFamily { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Media.FontFamily | This accepts all the FontFamily. |
FontSize
Gets or sets the font size of the annotation description.
Declaration
public double FontSize { get; set; }
Property Value
Type | Description |
---|---|
System.Double | It accepts the double value. |
FontStretch
Gets or sets the font stretch for the annotation description.
Declaration
public FontStretch FontStretch { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.FontStretch | This property of type |
FontStyle
Gets or sets the font style for the annotation description.
Declaration
public FontStyle FontStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.FontStyle | This property of type |
FontWeight
Gets or sets the font weight for the annotation description.
Declaration
public FontWeight FontWeight { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.FontWeight | This property of type |
Foreground
Gets or sets the foreground for the annotation description.
Declaration
public Brush Foreground { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Media.Brush | The System.Windows.Media.Brush value. |
IsUiCleared
Gets or sets a value indicating whether the UI is cleared.
Declaration
protected bool IsUiCleared { get; set; }
Property Value
Type |
---|
System.Boolean |
RotatedTextRect
Gets or sets the rotated System.Windows.Rect of the annotations.
Declaration
protected Rect RotatedTextRect { get; set; }
Property Value
Type |
---|
System.Windows.Rect |
ShowToolTip
Gets or sets a value indicating whether ToolTip
can be displayed in Annotation.
Declaration
public bool ShowToolTip { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The |
Text
Gets or sets the description text for Annotation.
Declaration
public string Text { get; set; }
Property Value
Type |
---|
System.String |
TextElement
Gets or sets the text element.
Declaration
protected ContentControl TextElement { get; set; }
Property Value
Type |
---|
System.Windows.Controls.ContentControl |
TextElementCanvas
Gets or sets the text element canvas.
Declaration
protected Canvas TextElementCanvas { get; set; }
Property Value
Type |
---|
System.Windows.Controls.Canvas |
ToolTipContent
Gets or sets the content to be displayed in annotation tooltip.
Declaration
public object ToolTipContent { get; set; }
Property Value
Type | Description |
---|---|
System.Object | This accepts all arbitrary .net objects. |
ToolTipPlacement
Gets or sets the position of the ToolTip.
Declaration
public ToolTipLabelPlacement ToolTipPlacement { get; set; }
Property Value
Type | Description |
---|---|
ToolTipLabelPlacement | will place the ToolTip left.
will place the ToolTip right.
will place the ToolTip top.
will place the ToolTip bottom.
|
ToolTipShowDuration
Gets or sets the elapse time for the ToolTip.
Declaration
public double ToolTipShowDuration { get; set; }
Property Value
Type | Description |
---|---|
System.Double | It accepts the |
ToolTipTemplate
Gets or sets the custom template for the ToolTip.
Declaration
public DataTemplate ToolTipTemplate { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.DataTemplate | This accepts the DataTemplate. System.Windows.DataTemplate |
Examples
<syncfusion:SfChart.Annotations>
<syncfusion:Annotation ShowToolTip="true" ToolTipTemplate="{StaticResource toolTipTemplate}">
</syncfusion:SfChart.Annotations>
annotation.ShowToolTip = true;
annotation.ToolTipTemplate = dataTemplate;
x1
Declaration
protected double x1 { get; set; }
Property Value
Type |
---|
System.Double |
X1
Gets or sets the x 1 value.
Declaration
public object X1 { get; set; }
Property Value
Type |
---|
System.Object |
XAxisName
Gets or sets the axis(horizontal) in which this annotation associated.
Declaration
public string XAxisName { get; set; }
Property Value
Type |
---|
System.String |
Remarks
This property works only with CoordinateUnit as CoordinateUnit.Axis
.
y1
Declaration
protected double y1 { get; set; }
Property Value
Type |
---|
System.Double |
Y1
Gets or sets the y 1 value.
Declaration
public object Y1 { get; set; }
Property Value
Type |
---|
System.Object |
YAxisName
Gets or sets the axis(vertical) in which this annotation associated.
Declaration
public string YAxisName { get; set; }
Property Value
Type |
---|
System.String |
Remarks
This property works only with CoordinateUnit as CoordinateUnit.Axis
.
Methods
CanUpdateRange(Object, Object)
Checks for the update requirement.
Declaration
protected bool CanUpdateRange(object x, object y)
Parameters
Type | Name | Description |
---|---|---|
System.Object | x | The x value. |
System.Object | y | The y value. |
Returns
Type | Description |
---|---|
System.Boolean | Returns the value indicating whether the range update required. |
Clone()
Returns the clone annotation
Declaration
public DependencyObject Clone()
Returns
Type | Description |
---|---|
System.Windows.DependencyObject | Returns the cloned annotation. |
CloneAnnotation(Annotation)
Clones the annotation.
Declaration
protected virtual DependencyObject CloneAnnotation(Annotation annotation)
Parameters
Type | Name | Description |
---|---|---|
Annotation | annotation | The annotation cloned is updated. |
Returns
Type | Description |
---|---|
System.Windows.DependencyObject | Returns the cloned annotation. |
EnsurePoint(Point, Point)
Calculates the ensure point.
Declaration
protected Point EnsurePoint(Point point1, Point point2)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Point | point1 | The first point |
System.Windows.Point | point2 | The second point |
Returns
Type | Description |
---|---|
System.Windows.Point | Returns the ensure point. |
GetClippingValues(Double, ChartAxis)
This method is used to modify the value for clipping out of axis
Declaration
protected double GetClippingValues(double value, ChartAxis axis)
Parameters
Type | Name | Description |
---|---|---|
System.Double | value | The value to be checked in clipping range. |
ChartAxis | axis | The axis to get the visible range. |
Returns
Type | Description |
---|---|
System.Double | Returns the clipped values. |
GetElementPosition(FrameworkElement, Point)
Gets the element position.
Declaration
protected Point GetElementPosition(FrameworkElement element, Point originalPosition)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.FrameworkElement | element | The annotation System.Windows.FrameworkElement. |
System.Windows.Point | originalPosition | The original position. |
Returns
Type | Description |
---|---|
System.Windows.Point | Returns the element position. |
GetElementPosition(Size, Point)
Gets the element position.
Declaration
protected Point GetElementPosition(Size desiredSize, Point originalPosition)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Size | desiredSize | The desired size to get alignment position. |
System.Windows.Point | originalPosition | The original position. |
Returns
Type | Description |
---|---|
System.Windows.Point | Returns the element position. |
GetRenderedAnnotation()
Gets the rendered annotation.
Declaration
public virtual UIElement GetRenderedAnnotation()
Returns
Type | Description |
---|---|
System.Windows.UIElement | A UI Element |
GetRotatePoint(Double, FrameworkElement, Point)
Gets the rotated points.
Declaration
protected Point GetRotatePoint(double angle, FrameworkElement item, Point originalPoint)
Parameters
Type | Name | Description |
---|---|---|
System.Double | angle | The specified angle. |
System.Windows.FrameworkElement | item | The System.Windows.FrameworkElement. |
System.Windows.Point | originalPoint | The original point. |
Returns
Type | Description |
---|---|
System.Windows.Point | Returns the matrix transformed. |
IntersectsWith(Rect, Rect)
Checks whether the given two System.Windows.Rect intersects.
Declaration
protected bool IntersectsWith(Rect r1, Rect r2)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Rect | r1 | The first System.Windows.Rect |
System.Windows.Rect | r2 | The second System.Windows.Rect |
Returns
Type | Description |
---|---|
System.Boolean | Returns a System.Boolean value indicating whether the two System.Windows.Rect are intersecting. |
OnSelected(EventArgs)
Invoked when an unhandled Selected event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
Declaration
protected virtual void OnSelected(EventArgs args)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | args | The System.EventArgs that contains the event data. |
OnUnSelected(EventArgs)
Invoked when an unhandled UnSelected event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
Declaration
protected virtual void OnUnSelected(EventArgs args)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | args | The System.EventArgs that contains the event data. |
RotateElement(Double, FrameworkElement)
Rotates the element to the specified angle.
Declaration
protected Rect RotateElement(double angle, FrameworkElement item)
Parameters
Type | Name | Description |
---|---|---|
System.Double | angle | The angle specified for rotation. |
System.Windows.FrameworkElement | item | The System.Windows.FrameworkElement. |
Returns
Type | Description |
---|---|
System.Windows.Rect | Returns the transformed element. |
RotateElement(Double, FrameworkElement, Size)
Rotates the element to the specified angle.
Declaration
protected Rect RotateElement(double angle, FrameworkElement item, Size itemSize)
Parameters
Type | Name | Description |
---|---|---|
System.Double | angle | The angle specified for rotation. |
System.Windows.FrameworkElement | item | The System.Windows.FrameworkElement. |
System.Windows.Size | itemSize | The System.Windows.FrameworkElement size. |
Returns
Type | Description |
---|---|
System.Windows.Rect | Returns the transformed element. |
SetBindings()
Sets the annotation bindings to the required elements.
Declaration
protected virtual void SetBindings()
SetData()
Sets the required x and y values.
Declaration
protected void SetData()
UpdateAnnotation()
Updates the annotation.
Declaration
public virtual void UpdateAnnotation()
Events
MouseDown
Occurs when the mouse button is pressed while the mouse pointer is over this element.
Declaration
public event MouseButtonEventHandler MouseDown
Event Type
Type |
---|
System.Windows.Input.MouseButtonEventHandler |
MouseLeave
Occurs when the mouse pointer leaves the bounds of this element.
Declaration
public event MouseEventHandler MouseLeave
Event Type
Type |
---|
System.Windows.Input.MouseEventHandler |
MouseLeftButtonDown
Occurs when the left mouse button is pressed while the mouse pointer is over this element.
Declaration
public event MouseButtonEventHandler MouseLeftButtonDown
Event Type
Type |
---|
System.Windows.Input.MouseButtonEventHandler |
MouseLeftButtonUp
Occurs when the left mouse button is pressed while the mouse pointer is over this element.
Declaration
public event MouseButtonEventHandler MouseLeftButtonUp
Event Type
Type |
---|
System.Windows.Input.MouseButtonEventHandler |
MouseMove
Occurs when mouse pointer is over this element.
Declaration
public event MouseEventHandler MouseMove
Event Type
Type |
---|
System.Windows.Input.MouseEventHandler |
MouseRightButtonDown
Occurs when the right mouse button is pressed while the mouse pointer is over this element.
Declaration
public event MouseButtonEventHandler MouseRightButtonDown
Event Type
Type |
---|
System.Windows.Input.MouseButtonEventHandler |
MouseRightButtonUp
Occurs when the right mouse button is released while the mouse pointer is over this element.
Declaration
public event MouseButtonEventHandler MouseRightButtonUp
Event Type
Type |
---|
System.Windows.Input.MouseButtonEventHandler |
MouseUp
Occurs when the mouse button is released while the mouse pointer is over this element.
Declaration
public event MouseButtonEventHandler MouseUp
Event Type
Type |
---|
System.Windows.Input.MouseButtonEventHandler |
Selected
Occurs when Annotation becomes selected.
Declaration
public event EventHandler Selected
Event Type
Type |
---|
System.EventHandler |
UnSelected
Occurs when Annotation becomes unselected.
Declaration
public event EventHandler UnSelected
Event Type
Type |
---|
System.EventHandler |