AnnotationBase

StockSharp.Xaml.Charting.Visuals.Annotations

Provides a base class for annotations to be rendered over the chart

Inherits: ApiElementBase

Implements: IAnnotation, IHitTestable, IPublishMouseEvents, IXmlSerializable, ISuspendable

Constructors

AnnotationBase()

Initializes a new instance of the AnnotationBase class.

Properties

AnnotationCanvas : AnnotationCanvas

Gets or sets the AnnotationCanvas to place the annotation on. The default is AboveChart

AnnotationOverlaySurface : IAnnotationCanvas

Gets the canvas over the Series on the parent UltrachartSurface

AnnotationUnderlaySurface : IAnnotationCanvas

Gets the canvas under the Series on the parent UltrachartSurface

CanEditText : bool

Gets or sets whether text can be edited on this AnnotationBase. Supported by Text or label annotations only

CoordinateMode : AnnotationCoordinateMode

Gets or sets the AnnotationCoordinateMode to use when placing the annotation. E.g. the default of Absolute requires that X1,Y1 coordinates are data-values. The value of Relative requires that X1,Y1 are double values from 0.0 to 1.0

DragDirections : XyDirection

Limits the Drag direction when dragging the annotation using the mouse, e.g in the X-Direction, Y-Direction or XyDirection. See the XyDirection enumeration for options

IsAttached : bool

Gets or sets whether this Element is attached to a parent UltrachartSurface

IsEditable : bool

Gets or sets whether the current annotation is editable. When editable, the user may click to select and interact with the annotation

IsHidden : bool

Gets or sets value, indicates whether current annotation was hidden by Hide call

IsResizable : bool

Gets value, indicates whether current instance is resizable

IsSelected : bool

Gets or sets whether the current annotation is selected. When selected, an Adorner is placed over the annotation to allow dynamic resizing and dragging by the user.

IsSuspended : bool

Gets a value indicating whether updates for the target are currently suspended

ResizeDirections : XyDirection

Limits the Resize direction when resiaing the annotation using the mouse, e.g in the X-Direction, Y-Direction or XyDirection. See the XyDirection enumeration for options

ResizingGripsStyle : Style

Gets or sets the Style which is applied to the resizing grips appearing when the annotation gets selected.

X1 : IComparable

Gets or sets the X1 Coordinate of the Annotation. For Absolute, this must be a data-value on the X-Axis such as a DateTime for DateTimeAxis, double for NumericAxis or integer index for CategoryDateTimeAxis. For Relative, this must be a double value between 0.0 and 1.0, where 0.0 is the far left of the XAxis and 1.0 is the far right.

X2 : IComparable

Gets or sets the X2 Coordinate of the Annotation. For Absolute, this must be a data-value on the X-Axis such as a DateTime for DateTimeAxis, double for NumericAxis or integer index for CategoryDateTimeAxis. For Relative, this must be a double value between 0.0 and 1.0, where 0.0 is the far left of the XAxis and 1.0 is the far right.

XAxis : IAxis

Gets the XAxis, which current annotation is bound to

XAxisId : string

Gets or sets the ID of the X-Axis which this Annotation is measured against

Y1 : IComparable

Gets or sets the Y1 Coordinate of the Annotation. For Absolute, this must be a data-value on the Y-Axis such as a double for NumericAxis For Relative, this must be a double value between 0.0 and 1.0, where 0.0 is the top of the YAxis and 1.0 is the bottom

Y2 : IComparable

Gets or sets the Y2 Coordinate of the Annotation. For Absolute, this must be a data-value on the Y-Axis such as a double for NumericAxis For Relative, this must be a double value between 0.0 and 1.0, where 0.0 is the top of the YAxis and 1.0 is the bottom

YAxis : IAxis

Gets the YAxis, which current annotation is bound to

YAxisId : string

Gets or sets the ID of the Y-Axis which this Annotation is measured against

Methods

AddAdorners(Canvas)

When overriden in a derived class, places the appropriate adorners on the AnnotationBase

adornerLayer
The adorner layer
AttachInteractionHandlersTo(FrameworkElement)

Attaches handlers to particular events of passed object

source
Mouse events source
DecrementSuspend()

Called by IUpdateSuspender each time a target suspender is disposed. When the final target suspender has been disposed, ResumeUpdates is called

DetachInteractionHandlersFrom(FrameworkElement)

When called in a derived class, detaches any mouse events which may have been previously attached to the AnnotationBase

source
Drag(double, double)

Raises the DragDelta event, called when a drag operation is in progress and each time the X1 Y1 X2 Y2 points update in the annotation

EndDrag()

Raises the DragEnded event, called when a drag operation ends

FocusInputTextArea()

Focuses the input text area. Applicable only for Text and label annotations

FromCoordinate(double, IAxis) : IComparable

Converts a pixel coordinate to data-value

coord
The pixel coordinate.
axis
The axis for which the data value is calculated

Returns: The datavalue

FromCoordinates(double, double) : IComparable[]

Converts pixel coordinates to data-values

xCoord
The X coordinate
yCoord
The Y coordinate

Returns: The data values

FromCoordinates(Point) : IComparable[]

Converts pixel coordinates to data-values

coords
The X, Y coordinates

Returns: The data values

FromRelativeCoordinate(double, IAxis) : IComparable

Converts a relative coordinate (e.g. 0.0 to 1.0) to data-value

coord
The relative coordinate, in the range of 0.0 to 1.0 for extremes of the viewport.
axis
The axis for which the data value is calculated

Returns: The datavalue

GetAdornerLayer() : Canvas

Gets the Adorner Canvas to place annotation adorners

GetBasePoints() : Point[]

This method is used in internally by the AnnotationResizeAdorner. Gets the adorner point positions

GetBasePoints(AnnotationCoordinates) : Point[]

This method is used in internally by the AnnotationResizeAdorner. Gets the adorner point positions

coordinates
The previously calculated AnnotationCoordinates in screen pixels.

Returns: A list of points in screen pixels denoting the Adorner corners

GetBoundsRelativeTo(IHitTestable) : Rect

Gets the bounds of the current IHitTestable element relative to another IHitTestable element

relativeTo
GetCanvas(AnnotationCanvas) : IAnnotationCanvas

Gets the Canvas instance for this annotation

annotationCanvas
The AnnotationCanvas enumeration

Returns: The canvas instance

GetCoordinates(IAnnotationCanvas, ICoordinateCalculator<double>, ICoordinateCalculator<double>) : AnnotationCoordinates

Gets an AnnotationCoordinates struct containing pixel coordinates to place or update the annotation in the current render pass

canvas
The canvas the annotation will be placed on
xCalc
The current XAxis ICoordinateCalculator to perform data to pixel transformations
yCalc
The current YAxis ICoordinateCalculator to perform data to pixel transformations

Returns: The AnnotationCoordinates struct containing pixel coordinates

GetPropertiesFromIndex(int, DependencyProperty, DependencyProperty)

Used internally to derive the X1Property, Y1Property, X1Property, Y2Property pair for the given index around the annotation.. e.g. index 0 returns X1,Y1 index 1 returns X2,Y1 index 2 returns X2,Y2 index 3 returns X1,Y2

index
The index
x
The X coordinate dependency property, either X1Property or X2Property
y
The Y coordinate dependency property, either Y1Property or Y2Property
GetSchema() : XmlSchema

Returns an XmlSchema that describes the XML representation of the object that is produced by the WriteXml method and consumed by the ReadXml method

GetSelectedCursor() : Cursor

Gets the Cursor to use for the annotation when selected

GetUsedAdorners``1(Canvas)

Gets a collection of the Adorners currently used on the Annotation, given the Annotation AdornerLayer Canvas

adornerLayer
The adorner layer canvas

Returns: A list of adorners matching type T

Hide()

Hides the Annotation by removing adorner markers from the parent AdornerLayerCanvas and setting Visibility to Collapsed

HideAdornerMarkers()

Hides adorner markers by calling Clear

IsCoordinateValid(double, double) : bool

Determines whether the coordinate is valid for placing on the canvas, e.g. is greater than zero and less than

coord
The coordinate.
canvasMeasurement
The canvas dimension in this axis.

Returns: true if coordinate is valid; otherwise, false.

IsInBounds(AnnotationCoordinates, IAnnotationCanvas) : bool

Performs a simple rectangular bounds-check to see if the X1,X2,Y1,Y2 coordinates passed in are within the Canvas extends

coordinates
The normalised AnnotationCoordinates
canvas
The canvas to check if the annotation is within bounds

Returns: True if in bounds

IsPointWithinBounds(Point) : bool

Returns true if the Point is within the bounds of the current IHitTestable element

point
The point to test

Returns: true if the Point is within the bounds

MakeInvisible()

Called internally by layout system when annotation is out of surface's bounds

MakeVisible(AnnotationCoordinates)

Called internally by layout system when annotation come into surface's bounds

MoveAnnotation(double, double)

This method is used internally by the AnnotationDragAdorner. Programmatically moves the annotation by an X,Y offset.

horizOffset
The horizontal offset to move in pixels
vertOffset
The vertical offset to move in pxiels
MoveAnnotationTo(AnnotationCoordinates, double, double) : ValueTuple<double, double>

Moves the annotation to a specific horizontal and vertical offset

coordinates
The initial coordinates.
horizOffset
The horizontal offset.
vertOffset
The vertical offset.
OnAnnotationLoaded(object, RoutedEventArgs)

Gets called as soon as the Loaded event occurs.

sender
e
OnAnnotationMouseDown(object, MouseButtonEventArgs)

Contains interaction logic of handling mouse down event

sender
e
OnAnnotationMouseMove(object, MouseEventArgs)

Contains interaction logic of handling mouse move event

sender
e
OnAnnotationMouseUp(object, MouseButtonEventArgs)

Contains interaction logic of handling mouse up event

sender
e
OnAnnotationPositionChanged(DependencyObject, DependencyPropertyChangedEventArgs)

DependencyProperty changed handler which can be used to refresh the annotation on property and position changed

OnAttached()

Called when the Annotation is attached to parent surface

OnAxisAlignmentChanged(IAxis, AxisAlignment)

Virtual method to override if you wish to be notified that the AxisAlignment has changed

axis
oldAlignment
OnDetached()

Called immediately before the Annotation is detached from its parent surface

OnRenderablePropertyChanged(DependencyObject, DependencyPropertyChangedEventArgs)

DependencyProperty changed handler which can be used to refresh the annotation on property changed

d
The DependencyObject sender.
e
The DependencyPropertyChangedEventArgs instance containing the event data.
OnXAxesCollectionChanged(object, NotifyCollectionChangedEventArgs)

Virtual method to override if you wish to be notified that the parent XAxes has changed

OnXAxisIdChanged()

Virtual method to override if you wish to be notified that the XAxisId has changed

OnYAxesCollectionChanged(object, NotifyCollectionChangedEventArgs)

Virtual method to override if you wish to be notified that the parent YAxes has changed

OnYAxisIdChanged()

Virtual method to override if you wish to be notified that the YAxisId has changed

PlaceAnnotation(AnnotationCoordinates)

Override in derived classes to handle specific placement of the annotation at the given AnnotationCoordinates

coordinates
The normalised AnnotationCoordinates
RaiseAnnotationDragEnded(bool, bool)

Initiates the DragEnded event

RaiseAnnotationDragging(double, double, bool, bool)

Initiates the DragDelta event

RaiseAnnotationDragStarted(bool, bool)

Initiates the DragStarted event

ReadXml(XmlReader)

Generates AnnotationBase from its XML representation.

reader
Refresh() : bool

Refreshes the annnotation position on the parent UltrachartSurface, without causing a full redraw of the chart

RemoveAdorners(Canvas)

Removes all adorners from the AnnotationBase

adornerLayer
The adorner layer
RemoveFocusInputTextArea()

Remove focus from input text area. Applicable only for Text and label annotation

ResumeUpdates(IUpdateSuspender)

Resumes the updates.

updateSuspender
The update suspender.
SetBasePoint(Point, int, IAxis, IAxis)

Called internally to marshal pixel points to X1,Y1,X2,Y2 values. Taking a pixel point () and base point , sets the X,Y data-values.

newPoint
The pixel point
index
The base point index, where 0, 1, 2, 3 refer to the four corners of an Annotation
yAxis
The current Y-Axis
xAxis
The current X-Axis
SetBasePoint(Point, int)

This method is used in internally by the AnnotationResizeAdorner. Programmatically sets an adorner point position

newPoint
index
Show()

Shows annotation which being hidden by Hide call

StartDrag(bool)

Raises the DragStarted event, called when a drag operation starts

SuspendUpdates() : IUpdateSuspender

Suspends drawing updates on the target until the returned object is disposed, when a final draw call will be issued

Returns: The disposable Update Suspender

ToCoordinate(IComparable, double, ICoordinateCalculator<double>, XyDirection) : double

Converts a Data-Value to Pixel Coordinate

dataValue
The Data-Value to convert
canvasMeasurement
The size of the canvas in the X or Y direction
coordCalc
The current ICoordinateCalculatorCoordinate Calculator
direction
The X or Y direction for the transformation
ToCoordinate(IComparable, IAxis) : double

Converts a data value to pixel coordinate

dataValue
The data value to convert
axis
The axis for which the coordinate is calculated

Returns: The coordinate in pixels

ToCoordinates(IComparable, IComparable, IAnnotationCanvas, ICoordinateCalculator<double>, ICoordinateCalculator<double>) : Point

Converts a data-values to pixel coordinates

xDataValue
The X data-value, e.g. value of X1 or X2
yDataValue
The Y data-value, e.g. value of Y1 or Y2
canvas
The AnnotationCanvas
xCoordCalc
The current X ICoordinateCalculator valid for the current render pass
yCoordCalc
The current Y ICoordinateCalculator valid for the current render pass

Returns: The pixel coordinates

TranslatePoint(Point, IHitTestable) : Point

Translates the point relative to the other IHitTestable element

point
The input point relative to this IHitTestable
relativeTo
The other IHitTestable to use when transforming the point

Returns: The transformed Point

TrySelectAnnotation() : bool

Tries to select the annotation. Returns True if the operation was successful

Returns: True if the operation was successful

Update(ICoordinateCalculator<double>, ICoordinateCalculator<double>)

Updates the coordinate calculators and refreshes the annotation position on the parent UltrachartSurface

xCoordinateCalculator
The XAxis ICoordinateCalculator
yCoordinateCalculator
The YAxis ICoordinateCalculator
UpdatePosition(Point, Point)

Updates the position and values of the annotation during a drag or resize operation, by setting X1,Y1,X2,Y2 and X,Y pixel coordinates together, from a pixel coordinate input

point1
The first input pixel coordinate
point2
The second input pixel coordinate
WriteXml(XmlWriter)

Converts AnnotationBase into its XML representation.

writer

Events

DragDelta : EventHandler<AnnotationDragDeltaEventArgs>

Occurs when current AnnotationBase is dragged or moved

DragEnded : EventHandler<AnnotationDragEventArgs>

Occurs when a Drag or move operation ends

DragStarted : EventHandler<AnnotationDragEventArgs>

Occurs when a Drag or move operation starts

IsHiddenChanged : EventHandler

Occurs when the IsHidden property is changed

MouseMiddleButtonDown : MouseButtonEventHandler

Occurs when the middle mouse button is pressed while the mouse pointer is over a UIElement.

MouseMiddleButtonUp : MouseButtonEventHandler

Occurs when the middle mouse button is released while the mouse pointer is over a UIElement. However, this event will only be raised if a caller marks the preceding MouseRightButtonDown event as handled; see Remarks.

Selected : EventHandler

Occurs when IAnnotation becomes selected.

Unselected : EventHandler

Occurs when IAnnotation becomes unselected.

Fields

AnnotationCanvasProperty : DependencyProperty

Defines the AnnotationCanvas DependencyProperty

AnnotationRoot : FrameworkElement

The Root Element of the Annotation to be displayed on the Canvas

CanEditTextProperty : DependencyProperty

Defines the CanEditText DependencyProperty

CoordinateModeProperty : DependencyProperty

Defines the CoordinateMode DependencyProperty

DragDirectionsProperty : DependencyProperty

Defines the DragDirections DependencyProperty

IsEditableProperty : DependencyProperty

Defines the IsEditable DependencyProperty

IsHiddenProperty : DependencyProperty

Defines the IsHidden DependencyProperty

IsSelectedProperty : DependencyProperty

Defines the IsSelected DependencyProperty

ResizeDirectionsProperty : DependencyProperty

Defines the ResizeDirection DependencyProperty

ResizingGripsStyleProperty : DependencyProperty

Defines the ResizingGripsStyle DependencyProperty

X1Property : DependencyProperty

Defines the X1 DependencyProperty

X2Property : DependencyProperty

Defines the X2 DependencyProperty

XAxisIdProperty : DependencyProperty

Defines the YAxisId DependencyProperty

Y1Property : DependencyProperty

Defines the Y1 DependencyProperty

Y2Property : DependencyProperty

Defines the Y2 DependencyProperty

YAxisIdProperty : DependencyProperty

Defines the YAxisId DependencyProperty