Series On click margin

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
BE
Newbie
Newbie
Posts: 41
Joined: Tue Nov 16, 2004 5:00 am

Series On click margin

Post by BE » Tue Jan 29, 2008 11:18 pm

Hi,

Is there a way to set TChart OnClickSeries mouse margin? I'm using the OnClickSeries event, but the mouse has to be right on the Series to receive the event. I'd like to change this so it is easier to click on a series.

Thanks

-Bill

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 Jan 30, 2008 9:31 am

Hi Bill,

You can achieve what you request doing something like this:

Code: Select all

procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var i, j, tolerance: Integer;
    p, l0, l1: TPoint;
begin
  tolerance := 10;

  p.X := X;
  p.Y := Y;

  for i:=0 to Chart1.SeriesCount-1 do
  begin
    for j:=1 to Chart1[i].Count-1 do
    begin
      l0.X := Chart1[i].CalcXPos(j-1);
      l0.Y := Chart1[i].CalcYPos(j-1);

      l1.X := Chart1[i].CalcXPos(j-1);
      l1.Y := Chart1[i].CalcYPos(j-1);

      if PointInLine(p, l0, l1, tolerance) then
      begin
        Chart1.Title.Text[0] := 'Series' + IntToStr(i+1) + 'clicked at point ' + IntToStr(j);
        break;
      end;
    end;
  end;
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

BE
Newbie
Newbie
Posts: 41
Joined: Tue Nov 16, 2004 5:00 am

Post by BE » Wed Jan 30, 2008 3:59 pm

Thanks

Is there a tolerance setting in TChart to do that? What does TChart use to determine if a mouse is over a Series?

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 Jan 31, 2008 8:45 am

Hi BE,

I'm afraid there's not such an option. Acutally, the PointInLine method I suggested is a TeeChart method, not Delphi's. TeeChart uses series's Clicked method for determining if they are being clicked or not.
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

BE
Newbie
Newbie
Posts: 41
Joined: Tue Nov 16, 2004 5:00 am

Post by BE » Thu Jan 31, 2008 2:09 pm

Thanks for the reply. I remember TTree had a Click tolerance parameter, so I was just wondering if the same is true with TChart.

bertrod
Advanced
Posts: 151
Joined: Wed Sep 07, 2005 4:00 am

Re: Series On click margin

Post by bertrod » Wed Jan 27, 2010 2:41 pm

Hello,

I was just wondering if you have introduced a Tolerance parameters for seriesClick in version 8 of TeeChart, or if I should still use the same function shown above ?

Thank you !

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

Re: Series On click margin

Post by Narcís » Thu Jan 28, 2010 4:09 pm

Hi bertrod,

I don't think this (TV52014661) has been implemented in v8. You can what has been implemented recently in the release notes.
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