Changing TBarSeries properties at runtime

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Gerben
Newbie
Newbie
Posts: 2
Joined: Mon Feb 28, 2005 5:00 am
Location: Utrecht, The Netherlands

Changing TBarSeries properties at runtime

Post by Gerben » Mon Aug 22, 2005 9:41 am

Hi !

I am working in the field of multivariate statistics. This means I like to handle a large amount of variables. Creating series for these variables at designtime is not an option, I like to create them at runtime. I am using this code in Delphi-7 and TeeChart VCL 7.04:

for i:= 1 to 31 do Chart.AddSeries(TBarSeries.Create(Self));

Adding data values for the bar charts and some basic formatting is not a problem using:

for i:= 1 to 31 do
for j:= 1 to 6 do
begin
Chart.Series.AddXY(j,SomeYvalue,'',MyColorList);
Chart.Series.Marks.Visible:=False;
Chart.Series.Color:=MyColorList;
Chart.Series.Title:=’TextInLegend’;
end;

No problem so far, but now I want to change the BarWidthPercent for the bar charts from the default 70% to 95%. And maybe I want to set other specific TBarSeries properties, that can not be reached by Chart.Series. Is there a way to accomplish this ?

Thanks for your attention and kind regards from Gerben

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Aug 22, 2005 10:04 am

Hi Gerben,

Yes, this is possible but to reach those properties you will need to type cast your series as Chart.Series[0] is of TChartSeries type:

Code: Select all

(Chart1.Series[i] as TBarSeries).BarWidthPercent:=95;
or

Code: Select all

(Chart1[i] as TBarSeries).BarWidthPercent:=95;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply