Page 1 of 1

[SOLVED] How to get XValue in OnClickBackground event ?

Posted: Wed Apr 11, 2007 10:50 am
by 9235956
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

Posted: Wed Apr 11, 2007 11:35 am
by narcis
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));
}

Posted: Wed Apr 11, 2007 12:03 pm
by 9235956
Hi Narcis,

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

MOS