Series Error at runtime?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
MikeBeachBum
Newbie
Newbie
Posts: 14
Joined: Fri Jun 22, 2007 12:00 am

Series Error at runtime?

Post by MikeBeachBum » Thu May 13, 2010 10:50 pm

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 );

}

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Series Error at runtime?

Post by Yeray » Fri May 14, 2010 8:43 am

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] );
}
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

MikeBeachBum
Newbie
Newbie
Posts: 14
Joined: Fri Jun 22, 2007 12:00 am

Re: Series Error at runtime?

Post by MikeBeachBum » Fri May 14, 2010 2:52 pm

That fixed it! Thanks!

Post Reply