Recent

Author Topic: [SOLVED] Is there a way to determine a axis by position  (Read 2556 times)

suilenroc1183

  • New member
  • *
  • Posts: 5
[SOLVED] Is there a way to determine a axis by position
« on: October 17, 2012, 09:36:23 pm »
Hi,
I have a chart with several y - axis and I will program a feature that a configuration dialog opens on double click on a axis.

My problem is to determine the axis under the mouse pointer. Is there a way to calculate the drawing area of an axis?

Thanks in advance

suilenroc

« Last Edit: October 30, 2012, 09:14:29 pm by suilenroc1183 »

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: Is there a way to determine a axis by position
« Reply #1 on: October 18, 2012, 04:56:59 am »
I do have plans to implement axis tools, but have no time right now.

Meanwhile, you can use TChartAxis.IsPointInside function.

suilenroc1183

  • New member
  • *
  • Posts: 5
Re: Is there a way to determine a axis by position
« Reply #2 on: October 30, 2012, 09:14:11 pm »
Hi,
thanks for this tip. IsPointInside is good enough for me to solve my problem.

Thanks for your great work on TAChart.

suilenroc

CM630

  • Hero Member
  • *****
  • Posts: 917
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: [SOLVED] Is there a way to determine a axis by position
« Reply #3 on: November 06, 2012, 01:29:09 pm »
To make things clearer, it could be mentioned that TChartAxis.IsPointInside behaves as TChartAxis.Marks.IsPointInside
If I click on the axis title, TChartAxis.IsPointInside returns false, still the title is a part of the axis.

Example:
Code: [Select]
procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.LeftAxis.Title.Visible:=True;
  Chart1.LeftAxis.Title.Caption:='Left axis title';
end;

procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
  APoint: TPoint;
begin
  APoint.x:=X;
  APoint.y:=Y;
if Chart1.LeftAxis.IsPointInside(APoint)= True then ShowMessage ('Inside');
end;

I would like to use the case to ask if there is a way to determine where the axis title is in the chart and/or if the mouse is inside it?
« Last Edit: November 06, 2012, 01:31:27 pm by paskal »
Лазар 2,0,10; W10 or W7 64bit; FPC3,2,0; rev 63526

 

TinyPortal © 2005-2018