How to create MultiChart application for C++Builder?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
anauta2024
Newbie
Newbie
Posts: 5
Joined: Tue Feb 13, 2024 12:00 am

How to create MultiChart application for C++Builder?

Post by anauta2024 » Fri May 31, 2024 8:30 am

The example exists for Delphi - Spark_series.pas, but for C++ this is more complicated.
What is better - AddSeries to Grid->Items[...][...] or to add chart and then AddSeries?
I need to refresh series data for at least 16 charts as fast as possible.

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

Re: How to create MultiChart application for C++Builder?

Post by Yeray » Mon Jun 03, 2024 1:41 pm

Hello,

Here the example translated to C++Builder:

Code: Select all

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  TChart *Chart1 = new TChart(this);
  Chart1->Parent = this;
  Chart1->Align = alClient;
  Chart1->View3D = false;

  Grid = new TChartLayoutTool(this);
  Chart1->Tools->Add(Grid);

  // We want 10x4 = 40 charts
  Grid->SetSize(10,4);

  // Set custom columns sizes. Automatic=0
  Grid->Columns->Item[0]->Size = 60;
  Grid->Columns->Item[0]->SizeUnits = muPixels;

  Grid->Columns->Item[1]->Size = 60;
  Grid->Columns->Item[1]->SizeUnits = muPercent;

  Grid->Columns->Item[2]->Size = 110;
  Grid->Columns->Item[2]->SizeUnits = muPixels;

  // First row, custom size
  Grid->Rows->Item[0]->Size = 90;
  Grid->Rows->Item[0]->SizeUnits = muPixels;

  // Add Series to all charts
  for (int Row = 0; Row < Grid->Rows->Count; Row++) {
	TAnnotationTool *Annotation = new TAnnotationTool(this);
	Grid->Items[Row][0]->Tools->Add(Annotation);

	Annotation->Text = "Row "+IntToStr(Row);

	TFastLineSeries *FastLine = new TFastLineSeries(this);
	Grid->Items[Row][1]->AddSeries(FastLine);
	FastLine->Marks->Hide();
	FastLine->FillSampleValues(100);
	//FastLine->ParentChart->Color=RGB(250,240,230);

	TPieSeries *Pie = new TPieSeries(this);
	Grid->Items[Row][2]->AddSeries(Pie);
	Pie->Marks->Hide();
	Pie->FillSampleValues(6);
	Pie->ParentChart->MarginTop = 10;

	TBarSeries *Bar = new TBarSeries(this);
	Grid->Items[Row][3]->AddSeries(Bar);
	Bar->Marks->Hide();
	Bar->FillSampleValues(6);
	Bar->ColorEachPoint=True;
	Bar->Marks->Show();
	Bar->Marks->Transparent=True;
  }
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

anauta2024
Newbie
Newbie
Posts: 5
Joined: Tue Feb 13, 2024 12:00 am

Re: How to create MultiChart application for C++Builder?

Post by anauta2024 » Thu Jun 06, 2024 7:00 am

Thank you!

Post Reply