CChart::DataToLP

CChart::LPToData

CChart::LPToNearest


void DataToLP( CDC *pDC, double *data, LPPOINT point );
void LPToData( CDC *pDC, LPPOINT point, double *data );
void LPToNearest( CDC *pDC, LPPOINT point, double *data, int dataID = -1 );

Parameters

Description

These functions do coordinate transformations between the data set and logical (screen) units.

DataToLP and LPToData convert using only the limits of the chart (the main axes always being the bottom and left, with the top or right used if the bottom or left do not exist).

LPToNearest, however, looks at the data specified by dataID and determines what the closest point is in the data to the specified logical point. For XY charts, "closest" means that it looks at the point along the x axis, and finds the nearest point along the x axis to that point. For image charts, it is just the x and y values, rounded to the nearest data value. The sample program uses LPToNearest in the CPlotView class to highlight the nearest data point.

The data ID is that returned by AddData or SetData.


CChart Reference | CPlot Reference