Page 1 of 1

Switch programatically between HorizontalBar, and Bar

Posted: Sun Nov 29, 2009 1:22 pm
by 10547084
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.

Re: Switch programatically between HorizontalBar, and Bar

Posted: Mon Nov 30, 2009 9:55 am
by yeray
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;