//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"

#include "ChartItem.hpp"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "PtblRV"
#pragma link "RichView"
#pragma link "RVScroll"
#pragma link "RVStyle"
#pragma link "ChartItem"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  // Filling charts
  Chart1->Series[0]->Add(1,"1",clTeeColor);
  Chart1->Series[0]->Add(2,"2",clTeeColor);
  Chart1->Series[0]->Add(3,"3",clTeeColor);
  Chart1->Series[0]->Add(4,"4",clTeeColor);

  Chart2->Series[0]->Add(1,"1",clTeeColor);
  Chart2->Series[0]->Add(2,"2",clTeeColor);
  Chart2->Series[0]->Add(3,"3",clTeeColor);
  Chart2->Series[0]->Add(4,"4",clTeeColor);
  Chart2->Series[1]->Add(4,"4",clTeeColor);
  Chart2->Series[1]->Add(3,"3",clTeeColor);
  Chart2->Series[1]->Add(2,"2",clTeeColor);
  Chart2->Series[1]->Add(1,"1",clTeeColor);



  RichView1->AddNL("Printing example",1,1);
  RichView1->AddBreak();

  TRVChartItemInfo* item = new TRVChartItemInfo(RichView1->RVData, Chart1, rvvaBaseline);
  item->ParaNo = 1;
  RichView1->AddItem("",item);

  RichView1->AddBreak();

  item = new TRVChartItemInfo(RichView1->RVData, Chart2, rvvaBaseline);
  item->ParaNo = 1;
  RichView1->AddItem("",item);
  RichView1->AddBreak();
  RichView1->AddNL("END OF DOC",0,0);


  RichView1->Format();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  RVPrint1->AssignSource(RichView1);
  RVPrint1->FormatPages(TRVDisplayOptions()) ;
  RVPrint1->Print("Chart",1,false) ;
}
//---------------------------------------------------------------------------

