TMarksTipTool & Series.Index value

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Ed
Newbie
Newbie
Posts: 33
Joined: Tue Mar 09, 2004 5:00 am
Location: Oregon, USA
Contact:

TMarksTipTool & Series.Index value

Post by Ed » Tue Apr 06, 2004 7:52 pm

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

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

Post by Marjan » Wed Apr 14, 2004 12:13 pm

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;
Marjan Slatinek,
http://www.steema.com

Post Reply