Page 1 of 1

CalcPosPoint problem

Posted: Mon Feb 07, 2005 9:15 pm
by 9336236
I am trying to use a vertical axis OnDrawLabel event handler to format my labels before displaying them. The values that I am calculating are numerically incorrect.

In the following code (simplified to show the error), RawY returns the incorrect value of 3.5798489669108.

Text contains the correct value of "3.400".

I don't understand the disparity between the value that TeeChart used to create the correct Text string and the value that is returned by CalcPosPoint().

Code: Select all

//-------------------------------------------------------------------------
// DrawVoltageAxisLabel
//-------------------------------------------------------------------------
void __fastcall TFrameChartRecorder::DrawVoltageAxisLabel(TChartAxis* Sender, int &X, int &Y, int &Z, AnsiString &Text, bool &DrawLabel)
{
   double RawY = Sender->CalcPosPoint(Y);

   double YValue = RoundTo(RawY, -2);

   Text = Format("%0.2n", ARRAYOFCONST((YValue)));
}

Posted: Fri Feb 11, 2005 6:55 am
by Marjan
Hi.

I think the problem is X and Y store the left-top position for axis label text. I wouldn't use this values for screen->axis value transformation.