Print Page | Close Window

How To Get Current Argument And Value?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Chart Control
Forum Description: Topics Related to Codejock Chart Control
URL: http://forum.codejock.com/forum_posts.asp?TID=18484
Printed Date: 06 May 2024 at 12:35pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How To Get Current Argument And Value?
Posted By: BleedX
Subject: How To Get Current Argument And Value?
Date 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!



Replies:
Posted By: kyotocanuck
Date 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...


Posted By: seanma
Date 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!


Posted By: mgampi
Date Posted: 14 February 2012 at 2:59am
I need this too!

+1Thumbs Up


-------------
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net