TMarksTipTool: OnHint index?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
TestAlways
Advanced
Posts: 228
Joined: Tue Aug 28, 2007 12:00 am
Location: Oregon, USA

TMarksTipTool: OnHint index?

Post by TestAlways » Tue Jul 13, 2010 3:53 pm

With a TMarksTipTool.OnGetText, there is no .Index property that I can find to know what help should be pointing at.

Any suggestions on how to find this?

Ed Dressel

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: TMarksTipTool: OnHint index?

Post by Yeray » Wed Jul 14, 2010 7:45 am

Hi Ed,

You could set the MarkTips Style to be smsPointIndex and use it at ChartTool1GetText:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  ChartTool1.Style:=smsPointIndex;
end;

procedure TForm1.ChartTool1GetText(Sender: TMarksTipTool; var Text: String);
var ValueIndex: Integer;
begin
  ValueIndex:=StrToInt(Text);
  Text:='X: ' + FloatToStr(Sender.Series.XValue[ValueIndex]) + #13 + 'Y: ' + FloatToStr(Sender.Series.YValue[ValueIndex]);
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

GoToXY
Newbie
Newbie
Posts: 81
Joined: Thu Apr 03, 2008 12:00 am

Re: TMarksTipTool: OnHint index?

Post by GoToXY » Wed Nov 03, 2010 10:05 pm

Hi, i found that topic and i must say that you need to change the event because when you use that tool on All Series, the Sender.Series = Nil
So, it should be a good idea to make it nice and add the Index and Series that as been "clicked / moved on" for the hint.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: TMarksTipTool: OnHint index?

Post by Narcís » Thu Nov 04, 2010 8:33 am

Hi GotoXY,
Hi, i found that topic and i must say that you need to change the event because when you use that tool on All Series, the Sender.Series = Nil
A safeguard could be implementing the event like this:

Code: Select all

procedure TForm1.ChartTool1GetText(Sender: TMarksTipTool;
  var Text: String);
begin
  if Assigned(Sender.Series) then
  begin
    ValueIndex:=StrToInt(Text);
    Text:='X: ' + FloatToStr(Sender.Series.XValue[ValueIndex]) + #13 + 'Y: ' + FloatToStr(Sender.Series.YValue[ValueIndex]);
  end;
end;
So, it should be a good idea to make it nice and add the Index and Series that as been "clicked / moved on" for the hint.
It can be easily found using TeeChart's mouse events combined with series' Clicked method. Anyway, I have added your request to the wish-list (TV52015263) to be considered for inclusion in future releases.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply