Page 1 of 1
Series On click margin
Posted: Tue Jan 29, 2008 11:18 pm
by 9339885
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
Posted: Wed Jan 30, 2008 9:31 am
by narcis
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;
Posted: Wed Jan 30, 2008 3:59 pm
by 9339885
Thanks
Is there a tolerance setting in TChart to do that? What does TChart use to determine if a mouse is over a Series?
Posted: Thu Jan 31, 2008 8:45 am
by narcis
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.
Posted: Thu Jan 31, 2008 2:09 pm
by 9339885
Thanks for the reply. I remember TTree had a Click tolerance parameter, so I was just wondering if the same is true with TChart.
Re: Series On click margin
Posted: Wed Jan 27, 2010 2:41 pm
by 9343260
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 !
Re: Series On click margin
Posted: Thu Jan 28, 2010 4:09 pm
by narcis
Hi bertrod,
I don't think this (TV52014661) has been implemented in v8. You can what has been implemented recently in the
release notes.