CloneChart in C++

TeeChart FireMonkey (Windows,OSX,iOS & Android) for Embarcadero RAD Studio, Delphi and C++ Builder (XE5+)
Post Reply
relayman
Newbie
Newbie
Posts: 20
Joined: Tue Jun 25, 2019 12:00 am

CloneChart in C++

Post by relayman » Wed Jun 26, 2019 3:09 pm

Hi,

Using C++ how can i clone a chart (not the series data, just the chart)? I don't know object pascal so i can't translate to C++.

Also, i'd like to clone charts so i can access them something like this Chart[1], Chart[2] for convenience (like an array).

thank you,
russ

p.s. I'm using Rad Studio 10.3.1 and working in C++ Builder.

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

Re: CloneChart in C++

Post by Yeray » Thu Jun 27, 2019 10:54 am

You can do this as follows:

Code: Select all

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  TChart *Charts[2];

  Charts[0] = new TChart(this);
  Charts[0]->Parent = this;
  TLineSeries *series = new TLineSeries(this);
  Charts[0]->AddSeries(series);
  series->FillSampleValues();

  Charts[1] = new TChart(this);
  CloneChart(Charts[1], Charts[0], this, false);
  Charts[1]->RemoveAllSeries();
  Charts[1]->Parent = this;
  Charts[1]->Top=Charts[0]->Height;

}
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

Post Reply