SharpPlot Reference > SharpPlot Methods > MapCoords - Convert chart co-ordinates to points

SharpPlot.MapCoords – Convert chart co-ordinates to points

Maps values from chart axes to points, relative to current origin. Returns two matching arrays of x and y values. This is useful for positioning text output and drawing arbitrary text, for example to annotate data points.

Example

yvec = sp.GetYTickPositions();

sp.NoteStyle = NoteStyles.Absolute;
nyv = sp.MapCoords(0,yvec)[1];

foreach (double ny in nyv)
  sp.DrawNote("Hello",0,ny);

Overloads

Description

When positioning text, it may be useful to convert from the co-ordinate system of the chart (defined by the (x,y) axes) to points. This allows you to use Absolute Positioning of Notes or Keys which is much more useful when making simple typographic adjustments, such as centre-lining text on the x-height of the font.

This simple utility takes note of the current state of the chart, and converts matching arrays of x and y values to an array of arrays of points, with appropriate origin for use with the AbsolutePosition style.

See also ...

SharpPlot Members | SharpPlot.GetXTickPositions Method | SharpPlot.GetYTickPositions Method


Send comments on this topic
© Dyalog Ltd 2016