using hit test on TeeChart

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Corey Panno
Newbie
Newbie
Posts: 8
Joined: Fri Sep 02, 2005 4:00 am

using hit test on TeeChart

Post by Corey Panno » Wed Feb 28, 2007 9:57 am

In the past I had used something like hit test to find the sub part of the chart under the cursor but have forgotton the exact details.

Also am not able to find any thing related to it in latest demo/examples etc. I am using TeeChart pro 7.07

Kindly help.

Regards

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

Post by Narcís » Wed Feb 28, 2007 10:51 am

Hi Corey,

Sorry but I don't understand what are you exactly trying to achieve here. Could you please give us more detailed information on what are you trying to get?

Thanks in advance.
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

Corey Panno
Newbie
Newbie
Posts: 8
Joined: Fri Sep 02, 2005 4:00 am

trying to find region under mouse

Post by Corey Panno » Thu Mar 01, 2007 11:55 am

Dear Narcís

Thanks for your kind reply.

Actually, I ws trying to get around another problem (TeeLineSeparator not working in displayed Series Titles in the graph).

I was thinking that if I can track the mouse cursor then atleast I can pop up some sort of hint with the full Series title because sometimes it gets truncated on the right side (if its length exceeds that of remaining width of TChart component).

for the above, I need to first of know as when the user is bringing mouse cursor over the series title .

Thanking you in advance in anticipation

with warm Regards

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

Post by Narcís » Thu Mar 01, 2007 12:12 pm

Hi Corey,

To check if the mouse is over the chart's title you can use OnMouseMove event and something like this:

Code: Select all

procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  if Chart1.Title.Clicked(X,Y) then
  begin
    //Put your hint code here.
  end;
end;
For the hint, I suggest you to use annotation tools as told here.
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

Corey Panno
Newbie
Newbie
Posts: 8
Joined: Fri Sep 02, 2005 4:00 am

but it does not works for series titles

Post by Corey Panno » Thu Mar 01, 2007 12:49 pm

Thanks once again for your kind reply but it does not works for the Series titles.

Please suggest some other alternatives.

I remeber using some sort of hit-detection in past, but am not able to get the details right. just as on TTreeview component, you can check if mouse cursor if over the button or image or text etc, same thing was somehow available in TChart also to know if the cursor is over the legend or title or axis etc etc.

Regards

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

Post by Narcís » Thu Mar 01, 2007 2:01 pm

Hi Corey,

I'm afraid I didn't understood what you were looking for. To display series title you may be interested in using TMarkTipsTool and use its OnGetText event doing something like this:

Code: Select all

procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var i: Integer;
begin
  for i:=0 to Chart1.SeriesCount-1 do
    if Chart1[i].Clicked(X,Y)<>-1 then
    begin
      SeriesIndex:=i;
      break;
    end;
end;

procedure TForm1.ChartTool1GetText(Sender: TMarksTipTool;
  var Text: String);
begin
  Text:=Chart1[SeriesIndex].Name;
  //or
  //Text:=Chart1[SeriesIndex].Title;
end;
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