Home > Net >  How to click on the chart that the points on the curve for that point coordinate values
How to click on the chart that the points on the curve for that point coordinate values

Time:09-26

As there are a number of points on the chart, these points together constitute a curve, how to get clicked point by clicking on the x y value

CodePudding user response:

Get the mouse at the interface between the x value, the date of the corresponding with you, and then take corresponding date y value on the curve,

CodePudding user response:

reference 1st floor u010227555 response:
to obtain the mouse at the interface between the x value, the date of the corresponding with you, and then take corresponding date y value on the curve,
can't direct selection point

CodePudding user response:

I just give you an idea, do you want to, you need to, when the mouse to click a point X, Y, then you have to let the program know which point your mouse point, so you need to get your mouse X value of current, and then to get points, Y value again, just thinking, do not know is not for you, or have a great spirit can provide a good answer,
refer to the second floor fenjiaogouzh77076 response:
Quote: refer to 1st floor u010227555 response:

To get the mouse at the interface between the x value, the date of the corresponding with you, and then take corresponding date y value on the curve,
not directly select a bit

CodePudding user response:

I said above, estimate the difficulty is to get the current mouse X value, this how have to you can go to check, as long as the X value, the rest is super easy,

CodePudding user response:

Void CChartCtrl: : OnLButtonDown (UINT nFlags, CPoint point)
{
SetCapture ();
If (m_bZoomEnabled)
{
M_bLMouseDown=true;
M_rectZoomArea. TopLeft ()=point;
M_rectZoomArea. BottomRight ()=point;
}

If (m_PlottingRect PtInRect (point))
{
TCursorMap: : iterator iter=m_mapCursors. The begin ();
For (iter. Iter!=m_mapCursors. End (); Iter++)
Iter - & gt; Second - & gt; onm ouseButtonDown (point);

Invalidate ().
}
/////add
Cstrings STR.
//string SSTR=(" point under the left key, the mouse is in x=% d, the location of the y=% d ", point, x, point, y);
//STR=_T (" point under the left key, the mouse is in x=% d, the location of the y=% d ", point, x, point, y);


SendMouseEvent (CChartMouseListener: : LButtonDown, point);
The CWnd: : OnLButtonDown (nFlags, point);
}
CChart inside a mouse click on the function, the inside of the point. The x, point. Y is the coordinates of the mouse to click, can according to the position of the mouse to click and curve location of conversion between curvilinear coordinates
  • Related