Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

XYDiagram2D.PointToDiagram(Point) Method

Converts the screen coordinates of a point into an XY-Diagram coordinates object.

Namespace: DevExpress.Xpf.Charts

Assembly: DevExpress.Xpf.Charts.v24.2.dll

NuGet Package: DevExpress.Wpf.Charts

#Declaration

public DiagramCoordinates PointToDiagram(
    Point p
)

#Parameters

Name Type Description
p Point

A Point object, representing a location on a chart’s display area.

#Returns

Type Description
DiagramCoordinates

A DiagramCoordinates object, containing information about the point’s argument and value, their scale types, associated axes and pane.

#Remarks

Use the PointToDiagram method, to convert screen coordinates of a point to the diagram coordinates (measured in axis units).

Note

For the opposite conversion (diagram coordinates to screen coordinates), use the XYDiagram2D.DiagramToPoint method (with an overload appropriate to your axes’ scale types).

#Example

This example demonstrates how to use a PointToDiagram method to transform screen coordinates to diagram coordinates.

Point position = e.GetPosition(chart);
DiagramCoordinates diagramCoordinates = diagram.PointToDiagram(position);
See Also