How To Get Current Argument And Value? |
Post Reply |
Author | |
BleedX
Newbie Joined: 02 June 2011 Status: Offline Points: 1 |
Post Options
Thanks(0)
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!
|
|
kyotocanuck
Newbie Joined: 30 November 2007 Status: Offline Points: 7 |
Post Options
Thanks(0)
|
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...
|
|
seanma
Newbie Joined: 13 February 2012 Status: Offline Points: 3 |
Post Options
Thanks(0)
|
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! |
|
mgampi
Senior Member Joined: 14 July 2003 Status: Offline Points: 1201 |
Post Options
Thanks(0)
|
I need this too!
+1 |
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
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 |