ComponentOne Chart for .NET (2.0) Search HelpCentral 

Coordinate Conversion Methods

Events such as the MouseMove event of .NET reports coordinate values and provide pixel coordinates from the chart area. This is useful to a degree, but it does not report to the application anything about the underlying data coordinates, data points, or chart areas.

Chart conversion methods allow the handling of instances where the end user’s cursor travels over the chart and performs an action.

The coordinate conversion methods of C1Chart help to provide this information from the pixel coordinates alone. By knowing just the pixel coordinates you can use any of the C1Chart coordinate conversion methods listed in the following table to determine data values for a particular series, data coordinates, and data indices:

Pixel to Data Coordinate Conversion Methods

Description

SeriesFromCoord

Obtains the group and series indices of the legend entry nearest to the specified client coordinates. Mouse coordinates are specified in client coordinates.

CoordToDataCoord

Calculates the data coordinates of a point in the PlotArea given chart client coordinates.

CoordToDataIndex

Returns series and point indices and distance to the closest data point in the group given client coordinates.

If you know the data coordinates or data indices, but don't know the pixel coordinates you can use the following methods to convert the data coordinates or data indices into pixel coordinates:

Data to Pixel Coordinate Conversion Methods

Description

DataIndexToCoord

Calculates the client coordinates of a point in the PlotArea given the data coordinates.

DataCoordToCoord

Returns the client coordinates of a specified data point.

When used in conjunction with .NET’s MouseMove event these tools allow for creation of interesting application-specific features like handling a double-click in the Legend and chart Tooltips. The MouseMove event of .NET reports the coordinates of the user’s cursor as it is dragged over the chart to get constantly updating data on where the user’s cursor is located. 

The following sections in this chapter briefly explain how to use each type of coordinate conversion method and provides an example of each one.

 


Converting Coordinates to Series

Converting Pixel Coordinates into Data Points and Vice Versa


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.