Reading x-axis y-axis values according to mousemov |
Post Reply |
Author | |
suji
Groupie Joined: 04 April 2018 Status: Offline Points: 15 |
Post Options
Thanks(0)
Posted: 30 January 2019 at 1:35am |
I want to read the values of the x and y axes according to mousemove.
class CChartContents : public CXTPChartControl { DECLARE_DYNAMIC(CChartContents) public: CChartContents(); virtual ~CChartContents(); protected: DECLARE_MESSAGE_MAP() public: afx_msg void OnMouseMove(UINT nFlags, CPoint point); }; void CChartContents::OnMouseMove(UINT nFlags, CPoint point) { TRACE(_T("\nx:%d, y:%d\n"), point.x, point.y); CXTPChartElement* pTemp = HitTest(point); CXTPChartControl::OnMouseMove(nFlags, point); } I have read the mouse point position value of chartcontrol. But what I need, the x, y value of the graph for the mouse point. Is there a way to read it? If the mouse position is at the red dot, you should read the value of x = 33, y = 20. |
|
BobC
Groupie Joined: 28 April 2017 Location: Longmont, CO Status: Offline Points: 55 |
Post Options
Thanks(0)
|
Here is a code snippet for what I use when a user clicks on a point in the chart. It should be enough to get you going for code to use in your mouse move handler.
My chart has dates across the X axis and a dollar value up the Y axis. When the user clicks a point on the chart, this code displays the date and dollar value. "pt" is the CPoint that was clicked, m_oChart is a CXTPChartControl object.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |