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
TMarksTipTool & Series.Index value
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):
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;
Marjan Slatinek,
http://www.steema.com
http://www.steema.com