Page 1 of 1
TMarksTipTool & Series.Index value
Posted: Tue Apr 06, 2004 7:52 pm
by 9336214
Is there anyway to know the index value in the TMarksTipTool.OnGetText event to customize the text based on the value at the index?
Thanks
Ed Dressel
Posted: Wed Apr 14, 2004 12:13 pm
by Marjan
Hi, Ed.
Not by using the OnGetMarkText event. But you could use the chart OnGetMouseMove event to check if current mouse position is under series point (use the TChartSeries.Clicked method to do this). Once you have valid ValueIndex (value <> -1), you can use this index in the TMarksTipTool to customize marks tip tool text. Something like this (simplified for one series):
Code: Select all
private
{ Private declarations }
Index : Integer;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues(10);
Index := -1;
end;
procedure TForm1.ChartTool1GetText(Sender: TMarksTipTool;
var Text: String);
begin
if Index <> -1 then Text := 'Clicked='+ IntToStr(Index);
end;
procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
Index := Series1.Clicked(X,Y);
end;