Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Chart Control
  New Posts New Posts RSS Feed - How To Get Current Argument And Value?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How To Get Current Argument And Value?

 Post Reply Post Reply
Author
Message
BleedX View Drop Down
Newbie
Newbie


Joined: 02 June 2011
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote BleedX Quote  Post ReplyReply Direct Link To This Post Topic: How To Get Current Argument And Value?
    Posted: 02 June 2011 at 3:41am
I'm using the chart control. And set it's zoom and scroll true.
When i click the mouse on it, how can i get the argument and value about the current mouse positon?
Please help me if anyone knows. Thanks!
Back to Top
kyotocanuck View Drop Down
Newbie
Newbie


Joined: 30 November 2007
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote kyotocanuck Quote  Post ReplyReply Direct Link To This Post Posted: 11 August 2011 at 10:06pm
I have this exact, same issue. Were you able to solve it? Ideally, all I want to do is click the chart and be able to determine which argument I clicked...
Back to Top
seanma View Drop Down
Newbie
Newbie


Joined: 13 February 2012
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote seanma Quote  Post ReplyReply Direct Link To This Post Posted: 13 February 2012 at 10:44am
Found a solution.

You will need to define your own derived class of CXTPChartControl, for example myCXTPChartCtrl
and in your derived class, for example, you defined OnLButtonDblClk function,

void myCXTPChartCtrl::OnLButtonDblClk( UINT nFlags, CPoint point )
{
   // here you get which point your mouse click at
   CXTPChartElement* hit =  HitTest ( point );

   // if the hitted element is valid type
   if( hit )
   {
       // if you want to check which data point your clicked on the chart series
       CXTPChartSeriesPoint* pPoint = DYNAMIC_DOWNCAST( CXTPChartSeriesPoint, hit );
      
       // if your hit is actually a point on the series
       if ( pPoint )
       {
            // do whatever you want, for example, get the actual value
           double value = pPoint->GetArgumentValue();
        }
    }
}

In the same way, you can get other types of element in the chart (for example, xAxis, yAxis, labels, chart series, markers, legends etc), remember everything is derived class of CXTPChartElement, so you only need to cast them to the type you want.

Happy coding!
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 14 February 2012 at 2:59am
I need this too!

+1Thumbs Up
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.