05-04-2005 11:26 AM
05-04-2005 06:42 PM
05-09-2005 05:02 AM
05-09-2005 07:22 AM
05-09-2005 07:48 AM
05-18-2005 07:53 AM
05-18-2005 11:40 PM
05-19-2005 10:05 AM
int GetGraphXYValueFromMouseCursorPos(int panel, int control, Point MousePos, Rect PlotArea, double *XValue, double *YValue)
{
int mapMode;
double XMin, XMax, YMin, YMax;
Point PixelPos;
double logBase = 10;
// Put the origin of { 0, 0 } in the lower left corner of the plot area
// (the mouse cursor has its origin in the upper left corner of the screen)
PixelPos.x = MousePos.x - PlotArea.left;
PixelPos.y = PlotArea.top + PlotArea.height - MousePos.y;
// get the axes min and max values
GetAxisScalingMode (panel, control, VAL_XAXIS, 0, &XMin, &XMax);
GetAxisScalingMode (panel, control, VAL_LEFT_YAXIS, 0, &YMin, &YMax);
GetCtrlAttribute (panel, GRAPHPANEL_GRAPH, ATTR_XMAP_MODE, &mapMode);
if(mapMode == VAL_LOG)
{
if(XMin <=0)
XMin = pow(logBase,-1);
XMin = log10(XMin);
XMax = log10(XMax);
*XValue = pow(logBase, XMin + (double)(PixelPos.x) * (XMax - XMin) / (double)PlotArea.width);
}else{
// calculate the output values
*XValue = XMin + (double)(PixelPos.x) * (XMax - XMin) / (double)PlotArea.width;
}
GetCtrlAttribute (panel, GRAPHPANEL_GRAPH, ATTR_YMAP_MODE, &mapMode);
if(mapMode == VAL_LOG)
{
if(YMin <=0)
YMin = pow(logBase,-1);
YMin = log10(YMin);
YMax = log10(YMax);
*YValue = pow(logBase, YMin + (double)(PixelPos.y) * (YMax - YMin) / (double)PlotArea.height);
}else{
// calculate the output values
*YValue = YMin + (double)(PixelPos.y) * (YMax - YMin) / (double)PlotArea.height;
}
return 1;
}
05-20-2005 05:09 AM