Page 1 of 1

How to change a TFastLineSeries into a TLineSeries?

Posted: Mon Jun 08, 2009 2:28 am
by 12049531
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?

Posted: Mon Jun 08, 2009 8:40 am
by yeray
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;