Page 1 of 1

Series Error at runtime?

Posted: Thu May 13, 2010 10:50 pm
by 10545663
Hello All,
We've been using TeeChart for many years. But I can't figure out what I am doing wrong in this code (BDS C++ Builder 2010, TeeChart 8.06). Can anyone tell me what is wrong? The vectors get added fine. But in the loop it throws an exception when trying to set "Custom" to true for the first item.
DcmChart->Draw();
DcmSeries->Clear();
DcmSeries->AddVector( 1, 1, 1, 2, 1, 1, "Nose", clBlue );
DcmSeries->AddVector( 1, 1, 1, 1, 2, 1, "Wing", clBlue );
DcmSeries->AddVector( 1, 1, 1, 1, 1, 2, "Down", clBlue );

for ( unsigned int i=0; i<3; ++i )
{
DcmSeries->Marks->Positions->Position->Custom = true;
DcmSeries->Marks->Positions->Position->LeftTop.x = DcmSeries->CalcXPosValue( DcmSeries->EndXValues->Value );
DcmSeries->Marks->Positions->Position->LeftTop.y = DcmSeries->CalcXPosValue( DcmSeries->EndYValues->Value );

}

Re: Series Error at runtime?

Posted: Fri May 14, 2010 8:43 am
by yeray
Hi Mike,

I think you should force the series to show the marks before modifying them and also force a Chart draw after adding your series' points. So it would be something like this:

Code: Select all

DcmSeries->Clear();
DcmSeries->AddVector( 1, 1, 1, 2, 1, 1, "Nose", clBlue );
DcmSeries->AddVector( 1, 1, 1, 1, 2, 1, "Wing", clBlue );
DcmSeries->AddVector( 1, 1, 1, 1, 1, 2, "Down", clBlue );
DcmSeries->Marks->Visible = true;

DcmChart->Draw();

for ( unsigned int i=0; i<3; ++i )
{
  DcmSeries->Marks->Positions->Position[i]->Custom = true;
  DcmSeries->Marks->Positions->Position[i]->LeftTop.x = DcmSeries->CalcXPosValue( DcmSeries->EndXValues->Value[i] );
  DcmSeries->Marks->Positions->Position[i]->LeftTop.y = DcmSeries->CalcXPosValue( DcmSeries->EndYValues->Value[i] );
}

Re: Series Error at runtime?

Posted: Fri May 14, 2010 2:52 pm
by 10545663
That fixed it! Thanks!