[SOLVED] How to get XValue in OnClickBackground event ?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Komar
Newbie
Newbie
Posts: 25
Joined: Thu Feb 10, 2005 5:00 am
Location: Savoie - France

[SOLVED] How to get XValue in OnClickBackground event ?

Post by Komar » Wed Apr 11, 2007 10:50 am

Hi,

I'm using Teechart pro 7.07 for C++ builder6.

I have a chart with a OnClickBackground event. In this event I would like to get the XValue of my click. The XValue must be the XValue of my bottom axis, at the place of my click, with my scale.

Do you know if it's a way to get that ?
Thanks...

MOS
Last edited by Komar on Wed Apr 11, 2007 12:04 pm, edited 1 time in total.

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 Apr 11, 2007 11:35 am

Hi lp,

Yes, you can do something like this:

Code: Select all

void __fastcall TForm1::Chart1ClickBackground(TCustomChart *Sender,
	  TMouseButton Button, TShiftState Shift, int X, int Y)
{
	double XVal = Chart1->Axes->Bottom->CalcPosPoint(X);
	Chart1->Title->Text->Add(FloatToStr(XVal));
}
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

Komar
Newbie
Newbie
Posts: 25
Joined: Thu Feb 10, 2005 5:00 am
Location: Savoie - France

Post by Komar » Wed Apr 11, 2007 12:03 pm

Hi Narcis,

Thanks for your answer. Your code has solve my problem. I didn't know the CalcPosPoint(X) function.
Thanks
:D

MOS

Post Reply