Page 1 of 1

series.custombarwidth to chart1.series[0].???

Posted: Sat Apr 09, 2005 4:42 am
by 9337383
Hi,
I am converting my "series1" to chart1.series[0] so I can change the series from bars to lines or whatever and still make it SaveChartToFile(..) and LoadChartFromFile(..).
Everything was compiling ok until I tried to change this line:

series1.custombarwidth := 5; // old line
chart1.series[0].CustomBarWidth := 5; // new line

The error message I get when I try to compile it is "Undeclared Identifier: 'CustomBarWidth'.

What is the equivalent of 'custombarwidth' when you reference a series using the "chart1.series[0]" notation?

Thank you.
pl

Posted: Mon Apr 11, 2005 7:19 am
by narcis
Hi pl,

That's because this notations refers to the generic series type and you need to cast them as BarSeries. You can do:

Code: Select all

(Chart1.Series[0] as TBarSeries).CustomBarWidth:=5;
or

Code: Select all

(Chart1[0] as TBarSeries).CustomBarWidth:=5;

Thanks

Posted: Fri Apr 15, 2005 10:13 pm
by 9337383
Hi,
That works great!.
Thanks. I appreciate your help.
pl