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.
How to create MultiChart application for C++Builder?
-
- Newbie
- Posts: 5
- Joined: Tue Feb 13, 2024 12:00 am
Re: How to create MultiChart application for C++Builder?
Hello,
Here the example translated to C++Builder:
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,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 5
- Joined: Tue Feb 13, 2024 12:00 am