![]() |
How To Get Current Argument And Value? |
Post Reply ![]() |
Author | |
BleedX ![]() Newbie ![]() Joined: 02 June 2011 Status: Offline Points: 1 |
![]() ![]() ![]() ![]() ![]() 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 |
![]() ![]() ![]() ![]() ![]() |
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 |
![]() ![]() ![]() ![]() ![]() |
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: 1198 |
![]() ![]() ![]() ![]() ![]() |
I need this too!
+1 ![]() |
|
Martin
Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0 Platform: Windows 10 v 1909 (64bit) Language: VC++ 2017 |
|
![]() |
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 |