CreateAnchor()

View as Markdown

Definition

Used to create a new chart anchor at a specified mouse point.

Method Return Value

A new ChartAnchor at a specified point in device pixels.

Syntax

CreateAnchor(Point point, ChartControl chartControl, ChartScale chartScale)

Method Parameters

ParameterDescription
pointA Point in device pixels representing the current mouse cursor position
chartControlA ChartControl representing the x-axis
chartScaleA ChartScale representing the y-axis

Examples

1public override void OnMouseDown(ChartControl chartControl, ChartPanel chartPanel, ChartScale chartScale, ChartAnchor dataPoint)**
2{
3 // get the point where the mouse was clicked
4 Point myPoint = dataPoint.GetPoint(chartControl, chartPanel, chartScale);
5
6 // create an anchor at that point
7 ChartAnchor MyAnchor = CreateAnchor(myPoint, chartControl, chartScale);
8
9 Print(MyAnchor.Time); // 3/16/2015 8:18:48 AM
10}