TForm1 *Form1;
TChartCircle *pSun, *pMercury, *pVenus, *pEarth;
TChartGroup    Group;
TChartPolyline Polyln;
TChartPoint *pPoint1, *pPoint2, *pPoint3;
TChart Line1, Line2, Line3, Line4, Line5;
TChartPoint Pt1(200,50),  Pt2(100,100);
TChartPoint Pt3(50,150),  Pt4(150,150);
TChartPoint Pt5(100,200), Pt6(200,200);
double TimeValue, TimeStep, TimeStop;


//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender) {
  pSun = new TChartCircle(150,150,10);
  pMercury = new TChartCircle(150,150-38,4);
  pMercury->SetValueX(150,"150+38*sin(4.17*100*(6.28*x/365))");
  pMercury->SetValueY(112,"150-38*cos(4.17*100*(6.28*x/365))");
  pVenus = new TChartCircle(150,150-72,10);
  pVenus->SetValueX(150,"150+72*sin(1.61*100*(6.28*x/365))");
  pVenus->SetValueY(78,"150-72*cos(1.61*100*(6.28*x/365))");
  pEarth = new TChartCircle(150,150-100,11);
//  pEarth->SetActiveValue(1,"if sin(100*(6.28*x/365))>0 then 1 else 0");
  pEarth->SetValueX(150,"150+100*sin(100*(6.28*x/365))");
  pEarth->SetValueY(50,"150-100*cos(100*(6.28*x/365))");
  Group.InsUnit(pSun);
  Group.InsUnit(pMercury);
  Group.InsUnit(pVenus);
  Group.InsUnit(pEarth);
//  Group.SetActiveValue(1,"if sin(100*(6.28*x/365))>-0.75 then 1 else 0");
  pPoint1 = new TChartPoint(10,10);
  pPoint2 = new TChartPoint(50,50);
  pPoint3 = new TChartPoint(150,10);
  Polyln.InsPoint(pPoint1);
  Polyln.InsPoint(pPoint2);
  Polyln.InsPoint(pPoint3);

  Line5.SetFirstPoint(&Pt6);
  Line5.SetLastPoint(&Pt4);

  Line4.SetFirstPoint(&Pt5);
  Line4.SetLastPoint(&Line5);

  Line3.SetFirstPoint(&Line4);
  Line3.SetLastPoint(&Pt2);

  Line2.SetFirstPoint(&Pt3);
  Line2.SetLastPoint(&Line3);

  Line1.SetFirstPoint(&Line2);
  Line1.SetLastPoint(&Pt1);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::BitBtn1Click(TObject *Sender) {
  pSun->Show();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::BitBtn2Click(TObject *Sender) {
  if ( Group.IsVisible() ) Group.Hide();
  else Group.Show();

}
//---------------------------------------------------------------------------

void __fastcall TForm1::BitBtn3Click(TObject *Sender) {
  TimeValue = 0;
  TimeStep  = 0.1;
  TimeStop  = 20;
  Timer1->Enabled = true;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Timer1Timer(TObject *Sender) {
  Group.ViewTimeShot(TimeValue);
  TimeValue +=TimeStep;
  if ( TimeValue > TimeStop )   Timer1->Enabled = false;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::BitBtn4Click(TObject *Sender) {
  if ( Polyln.IsVisible() ) Polyln.Hide();
  else Polyln.Show();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::BitBtn5Click(TObject *Sender) {
  if ( Line1.IsVisible() ) Line1.Hide();
  else Line1.Show();

}
//---------------------------------------------------------------------------
Хостинг от uCoz