Knowledgebase
Convert Pixel to Data Coordinates
Posted by Admin - on 07 February 2019 03:30 PM

SciChart provides a clean and simple API to transform pixels to data-values and vice versa via the Coordinate Calculators API. It is the core API that is used extensively almost everywhere.

Where Pixel Coordinates are measured from

It is important to note when converting Pixels to Data Coordinates and vice versa that pixels are measured from the top-left inside corner of the chart. So, the pixel coordinate (0,0) corresponds to the data-value at (XAxis.VisibleRange.Min, YAxis.VisibleRange.Max), and the pixel coordinate (width, height) corresponds to the data-value at (XAxis.VisibleRange.Max, YAxis.VisibleRange.Min):

The conversion is performed by XAxis and YAxis inside the Axis.GetCoordinate() and Axis.GetDataValue() methods, where the first one is used to convert data (chart) coordinates into pixel coordinates relative to SciChartSurface, and the second one does the opposite.

For further information, please see our documentation Axis APIs - Convert Pixel to Data Coordinates.

(4 vote(s))
Helpful
Not helpful

CONTACT US

Not sure where to start? Contact us, we are happy to help!


CONTACT US

SciChart Ltd, 16 Beaufort Court, Admirals Way, Docklands, London, E14 9XL. Email: Legal Company Number: 07430048, VAT Number: 101957725