Programming User Interaction > Returning Coordinate Values > Converting Pixel Coordinates to Data Coordinates |
To convert from pixel coordinates to data coordinates, call CoordToDataCoord. For example, the following converts the pixel coordinates (225, 92) to their equivalent data coordinates:
Dim DataX As Double
Dim DataY As Double
Dim Region As Integer
With Chart2D1.ChartGroups(1)
Region = CoordToDataCoord 225, 92, DataX, DataY
End With
' DataX and DataY now contain the data coordinate value
CoordToDataCoord returns, as its return value, the region of the chart in which the pixel coordinates are located. This region is represented as a region constant.