Switch programatically between HorizontalBar, and Bar

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Doogie
Newbie
Newbie
Posts: 12
Joined: Mon Oct 22, 2007 12:00 am
Contact:

Switch programatically between HorizontalBar, and Bar

Post by Doogie » Sun Nov 29, 2009 1:22 pm

Hi,

Is it at all possible, to toggle the chart between Horizontal Bar, and Bar, with the same data, but differently orientated, according to user preference.

If possible, how do I achieve this in code?


I want to rotate this from HorizontalBar to Bar.
Attachments
horbarfixed.jpg
horbarfixed.jpg (57.76 KiB) Viewed 5560 times

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

Re: Switch programatically between HorizontalBar, and Bar

Post by Yeray » Mon Nov 30, 2009 9:55 am

Hi Doogie,

Yes, you could use ChangeSeriesType function. For example:

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
var i: Integer;
    tmp: TChartSeries;
begin
  for i:=0 to Chart1.SeriesCount-1 do
  begin
    tmp:=Chart1[i];
    if Chart1[i] is THorizBarSeries then ChangeSeriesType(tmp,TBarSeries)
    else ChangeSeriesType(tmp,THorizBarSeries);
  end;
end;
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