Page 1 of 1

DblClick TseriesMarks

Posted: Fri May 26, 2006 6:12 am
by 8440834
I'd like to open a form after double clicking on a series mark of any series in a multi-series chart. The MarkText determines the content of the edit box on the form. Clicking the mark does not give me access to the MarkText. Only the index is returned using the clicked method of TSeriesMarks, which doesn't help much if I can not determine which series the mark belongs to. Do I have to click the series below the mark to obtain the Marktext?

I'm definitely missing something somewhere. I'd be most grateful for any advice :) .

Posted: Tue May 30, 2006 2:57 pm
by Pep
Hi,

to get the MarkText of the double clicked Mark you can use similar code to the following :

Code: Select all

procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var tmpL : Integer;
begin
if dblclick then
begin
  tmpL := Chart1.Series[0].Marks.Clicked(X,Y);
  If (tmpL <> -1) Then
    showmessage(Chart1.Series[0].Labels[tmpl]);

    dblclick := false;
    Abort;
  end;
end;

procedure TForm1.Chart1DblClick(Sender: TObject);
begin
    dblclick := true;
end;
Of course, if you have more than one Series you must iterate through all the Series checking is one of its points has been clicked (just checking one Series in the sample I posted above).

Many thanks

Posted: Wed May 31, 2006 8:51 pm
by 8440834
Works like a charm :D

Thank you very much, Pep 8)