Page 1 of 1

Change chart style

Posted: Wed Dec 03, 2003 12:40 pm
by 5890703
Could you show me how to programmatically change the series style from a line graph to a vertical bar graph, with the bar option of rectangle 2-d and bar width of 30%. I know how to edit the chart manually, but would prefer to automate the process.

Posted: Wed Dec 03, 2003 1:35 pm
by Marjan
Hi.

Let's say you have a series of a TLineSeries type. Try using the following code to change it to TBarSeries type:

Code: Select all

var tmp: TChartSeries;
begin
  tmp := Chart1.Series[0];
  ChangeSeriesType(tmp,TBarSeries);
  with Chart1.Series[0] as TBarSeries do
  begin
    BarWidthPercent := 30;
    ParentChart.View3D := False;
  end;