Page 1 of 1

Question about Right click on chart

Posted: Tue Jul 10, 2007 11:14 am
by 10045570
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

Posted: Fri Jul 13, 2007 11:20 am
by Pep
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.

Posted: Fri Jul 20, 2007 2:24 pm
by 10045570
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

Posted: Sat Jul 21, 2007 5:49 am
by Marjan
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.

Clicked Point Mark

Posted: Mon Aug 13, 2007 6:29 pm
by 9344022
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

Posted: Tue Aug 14, 2007 8:01 am
by yeray
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;

Posted: Tue Aug 14, 2007 12:44 pm
by 9344022
It worked!!!

Thanks a lot Yeray !