TChart.SeriesList.Add(..) vs. TChart.AddSeries(..)

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
jens.mertelmeyer
Newbie
Newbie
Posts: 60
Joined: Fri Nov 22, 2013 12:00 am

TChart.SeriesList.Add(..) vs. TChart.AddSeries(..)

Post by jens.mertelmeyer » Thu Sep 18, 2014 8:45 am

I have a feeling that something this obvious is somewhere in the documentation but I can't find anything.

How would one go about adding a TChartSeries at runtime? Please have a look at this:

Code: Select all

implementation uses VclTee.Series;
{$R *.dfm}

procedure TForm3.Button1Click(Sender: TObject);
var
	newSeries:  TChartSeries;
begin
	newSeries := TLineSeries.Create(chart1);
	newSeries.FillSampleValues();

	(* this is bad:
	newSeries.ParentChart := chart1;
	Chart1.SeriesList.Add(newSeries) *)

	// this is good
	Chart1.AddSeries(newSeries);
end;
I only found the quote
Warning: Never FREE or REMOVE SeriesList elements. Use the Series.Free to remove it or use the Series.Active property to disable it.
on the documentation for TCustomAxisPanel.SeriesList

My question is: Why?
So if I want to add a TChartSeries, always use the chart directly, not the SeriesList? If yes, then why does the TSeriesList even expose Methods like Add() in the first place?


Many thanks in advance.

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

Re: TChart.SeriesList.Add(..) vs. TChart.AddSeries(..)

Post by Yeray » Thu Sep 18, 2014 11:59 am

Hello,

I think it's public just to preserve the backwards compatibility.
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