How to change a TFastLineSeries into a TLineSeries?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
QTech
Newbie
Newbie
Posts: 16
Joined: Wed Jul 02, 2008 12:00 am

How to change a TFastLineSeries into a TLineSeries?

Post by QTech » Mon Jun 08, 2009 2:28 am

I have a TFastLineSeries that I want to convert into a TLineSeries. Is there a function that I can use like CloneChartSeries that will create a new object of a different class type?

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

Post by Yeray » Mon Jun 08, 2009 8:40 am

Hi QTech,

Yes, you could combine CloneChartSeries and ChangeSeriesType metods as follows:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var tmp: TChartSeries;
    series1: TFastLineSeries;
    series2: TLineSeries;
begin
  series1 := TFastLineSeries.Create(self);
  Chart1.AddSeries(series1);
  series1.FillSampleValues(25);

  tmp := CloneChartSeries(series1);
  series2 := ChangeSeriesType(tmp, TLineSeries) as TLineSeries;
  Chart1.AddSeries(series2);
end;
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