Question about Right click on chart

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
IQSoft
Newbie
Newbie
Posts: 20
Joined: Mon Jun 18, 2007 12:00 am
Location: Greece
Contact:

Question about Right click on chart

Post by IQSoft » Tue Jul 10, 2007 11:14 am

I have a chart whith 4 line series
How can i open a popup when the user Right click or Shift-Right click and find the series and the point which is closer to it?????
And something else...
I read measurements from a database and draw them in a chart series I draw x,y values . Is it possible to have and an id stored in the chart so when the user selects a point in the chart to be able to find thiw measyrement by its id???? i dont want thiw id to be viewd by the user in thw chart...
Thanks in advanced....
Alex

Pep
Site Admin
Site Admin
Posts: 3301
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Fri Jul 13, 2007 11:20 am

Hi Alex,

1) How about using the OnClickPointer event of the Series ?

Code: Select all

procedure TForm1.Series1ClickPointer(Sender: TCustomSeries; ValueIndex, X,
  Y: Integer);
begin
  showmessage(floattostr(sender.YValues.Value[Valueindex]));
end;
2) Well you could ideintify it by its index in the Series, as in the previous question, once the user clicks over any point, a valueindex is returned allowing you to search for the information about this point.

IQSoft
Newbie
Newbie
Posts: 20
Joined: Mon Jun 18, 2007 12:00 am
Location: Greece
Contact:

Post by IQSoft » Fri Jul 20, 2007 2:24 pm

1)The chart is created dynamicly by code
on every new lineseries i create how can i assign the onclickpointer event????

2) For the second question
I have the data id,x,y for every series in chart i give the values x,y to the chart and i want to be able or to store in the chart and the id of the points ( database table id and not chart series id) so i cant call a query to find the record for the point from the database

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Sat Jul 21, 2007 5:49 am

Hi.

Re #1: Yes, sure, you can assign the OnClick event to dynamically created series. Something like this should work fine:

Code: Select all

procedure TForm1.Series1ClickPointer(Sender: TCustomSeries; ValueIndex, X, 
  Y: Integer); 
begin 
  ShowMessage(floattostr(Sender.YValues.Value[Valueindex])); 
end;

procedure TForm1.AddSeries;
var i:Integer;
begin
  Chart1.FreeAllSeries;
  for i:=0 to 3 do 
  begin
    Chart1.AddSeries(TPointSeries);
    (Chart1[i] as TPointSeries).OnClickPointer := Series1ClickPointer;
  end;
end;
Re #2: You could use series XLabels string array for storing the id's, or alternatively, derive new custom series from point series and add another TChartValueList (idlist) to it. I'd go with the first solution as it's far simpler and requires no extra coding.
Marjan Slatinek,
http://www.steema.com

StoneAge
Newbie
Newbie
Posts: 6
Joined: Tue Nov 01, 2005 5:00 am

Clicked Point Mark

Post by StoneAge » Mon Aug 13, 2007 6:29 pm

Hi,
I use D7 and TeeChart707.

I have a line Series Graph, and I show the points in the series.
How can I show only the clicked point mark?

With ShowMessage the OnclickSeries works, but when I try to show only the clicked point mark, it doesn't work.

And ideas?!

Thanks,
Livia

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Tue Aug 14, 2007 8:01 am

Hi Livia,

The easiest way to achieve this is using the "Mark Tips Tool" and probably you would like to set it as follows:

Code: Select all

ChartTool1.MouseAction := mtmClick;
ChartTool1.MouseDelay := 0;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

StoneAge
Newbie
Newbie
Posts: 6
Joined: Tue Nov 01, 2005 5:00 am

Post by StoneAge » Tue Aug 14, 2007 12:44 pm

It worked!!!

Thanks a lot Yeray !

Post Reply