Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MouseMove command not displays correct values.

Status
Not open for further replies.

Bachatero

Programmer
Aug 30, 2006
36
NL
Hi all,

What do I do wrong ???

I have an energy spectrum displayed in a TChart. On the Y-axis the counts are displayed. On the X-axis the Energy (KeV's) are displayed. So far so good. Now I use a fastcall::EnergyChartMouseMove() to locate where the mouse pointer is displayed in the Chart with the following command:

Energy->Caption = EnergySerie1->GetHorizAxis->CalcXPosValue(nX);

The minimum Xposition on the lefthand side of the chart is:99 and the energy is:33 KeV.
The maximum Xposition on the righthand side of the chart is:1166 and the energy is 246 Kev.

So there are 0,199 Kev's per pixel. If I move my mouse in the Chart to the Xlocation where the peak has it's maximum counts (140 KeV) the mouse pointer displays 636 pixels, that equals 636*0,199 = 127 KeV and not 140 KeV

Allthow it looklies that the axis is not linear, the axis properties logarithmic in TChart is set to FALSE.

Any idea what is going wrong???

Thanks in advance!

Johan




 
I suspect that there is a rounding error somewhere. 127 [÷] 636 = 0.199685534591195. Very close to .199 but not close enough as you see.


James P. Cottingham
-----------------------------------------
I'm number 1,229!
I'm number 1,229!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top