Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Retrieving Values

 Post Reply Post Reply
Author
McKenzie Dexter View Drop Down
New Member
New Member
Avatar

Joined: 05 Mar 2011
Posts: 7
Post Options Post Options   Quote McKenzie Dexter Quote  Post ReplyReply Direct Link To This Post Topic: Retrieving Values
    Posted: 06 May 2011 at 1:36am
Hi,
 
i have a simple question I'm having trouble finding the answer to.  I want to click on a data point and get the value.  I tried the MouseDown, and I see there is a "Value" variable returned but it is not the exact value of the data in the series.  It's always slightly higher.  I was assuming the "Value" was the value of the data point but it appears it is not.
 
Thanks,
 
Dexter
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3463
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 06 May 2011 at 2:52am
Hi, 

You can use  AdvChartView1.XYToSeriePoint() to return the closest value at the mousedown X and Y position.

Regards, 
Scheldeman Pieter

Back to Top
McKenzie Dexter View Drop Down
New Member
New Member
Avatar

Joined: 05 Mar 2011
Posts: 7
Post Options Post Options   Quote McKenzie Dexter Quote  Post ReplyReply Direct Link To This Post Posted: 07 May 2011 at 4:34am
Hi Pieter,
 
Thanks for the reply.
 
What I want to be able to do is click on the bar and be able to get the actual value in the series.  The function below appears to return coorindates but it always returns [-1,-1] for me. 
 
Thanks,
 
Dexter
 
procedure TDashboard.DBAdvGDIPChartView1SerieMouseDown(Sender: TObject;
  Button: TMouseButton; PaneIndex, SerieIndex, Index: Integer;
  value: Double; X, Y: Integer);
var
  ct: TChartSeriePoint;
begin
  CT := DBAdvGDIPChartView1.XYToSeriePoint(X,Y,PaneIndex);
 
Back to Top
McKenzie Dexter View Drop Down
New Member
New Member
Avatar

Joined: 05 Mar 2011
Posts: 7
Post Options Post Options   Quote McKenzie Dexter Quote  Post ReplyReply Direct Link To This Post Posted: 07 May 2011 at 1:07pm
Hi,
 
Here is what I was looking for.  Just in case it helps anyone else.
 
I have a multi series bar chart.  The user wants to be able to click on the bar to retrieve the series value at that location so we can pop up some customized messages depending on the value.  What I got to work was:
 
procedure TForm1.DBAdvGDIPChartView1SerieMouseDown(Sender: TObject;
  Button: TMouseButton; PaneIndex, SerieIndex, Index: Integer;
  value: Double; X, Y: Integer);
var
  dPointValue : Double;
begin
  dPointValue := DBAdvGDIPChartView1.Panes[0].Series[SerieIndex].Points[index].SingleValue;
  Showmessage('The value at this location is '+floattostr(dPointValue));
end;
 
You have to click on the Marker but that's ok.
 
Thanks,
 
Dexter
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down