Hello,
Is there a easy and quick way to know if a coordinate X,Y (chart pixels) are inside a TSeriesBandTool area ?
[TSeriesBandTool] How to know when X,Y is in seriesBandTool?
Hi bertrod,
We've made an example of how you can achieve this in a not very complicated way. In a few words it consists on search up for a series, and down for another one when the chart is clicked.
And also note that we've added to our wish-list the request to implement Clicked method for TSeriesBandTool in future releases.
We've made an example of how you can achieve this in a not very complicated way. In a few words it consists on search up for a series, and down for another one when the chart is clicked.
And also note that we've added to our wish-list the request to implement Clicked method for TSeriesBandTool in future releases.
Code: Select all
type
...
private
{ Private declarations }
function SeriesClicked(X,Y: Integer): Boolean;
...
procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var CursorUp, CursorDown: Integer;
begin
for CursorUp:=Y downto Chart1.ChartRect.Top do
begin
if SeriesClicked(X, CursorUp) then
begin
for CursorDown:=Y to Chart1.ChartRect.Bottom do
if SeriesClicked(X, CursorDown) then
begin
Chart1.Title.Text[0]:='Point in SeriesBand';
break;
end
else
Chart1.Title.Text[0]:='Point NOT in SeriesBand';
break;
end
else
Chart1.Title.Text[0]:='Point NOT in SeriesBand';
end;
end;
function TForm1.SeriesClicked(X, Y: Integer): Boolean;
begin
result:=((Series1.Clicked(X, Y)<>-1) or (Series2.Clicked(X, Y)<>-1));
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |