Change chart style

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Hans Wolfgang
Newbie
Newbie
Posts: 58
Joined: Fri Nov 15, 2002 12:00 am
Location: Naples, FL
Contact:

Change chart style

Post by Hans Wolfgang » Wed Dec 03, 2003 12:40 pm

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.

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Wed Dec 03, 2003 1:35 pm

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;

Post Reply