TGantt Problem

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Friis
Newbie
Newbie
Posts: 23
Joined: Mon May 07, 2012 12:00 am

TGantt Problem

Post by Friis » Fri Nov 09, 2012 3:00 pm

Hi,

When using the code below, the legend does not indicate the red color - Is this a bug or am I doing something wrong...??

Code: Select all

begin
Chart1.Legend.Visible := true;
Chart1.Legend.Alignment := laBottom;
Chart1.Legend.LegendStyle := lsSeries;

with Chart1.AddSeries(TGanttSeries.Create(self)) as TGanttSeries do
  begin
    ParentChart := Chart1;
    Title := 'ItemNumber 040170';
    ShowInLegend := true;
    //ColorEachPoint := false;

    with Chart1[Chart1.SeriesCount-1] as TGanttSeries do
      begin
        Pointer.VertSize:=10;
        AddGanttcolor(now,now+1,-1,'',clred);
      end;
  end;
end;
Attachments
Unavngivet.JPG
Unavngivet.JPG (19.2 KiB) Viewed 820 times

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

Re: TGantt Problem

Post by Yeray » Fri Nov 09, 2012 4:17 pm

Hi Hans,

It's a normal behaviour.
When ColorEachPoint is true, as you'll understand, TeeChart can't decide what point color to use as the whole series color.
Also note, the TGanttSeries has the ColorEachPoint property as true by default.
However, setting it to false and assigning a color to the series, I think works as you'd like to.

Code: Select all

uses GanttCh;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.Legend.LegendStyle := lsSeries;
  with Chart1.AddSeries(TGanttSeries) as TGanttSeries do
  begin
    ColorEachPoint:=false;
    Color:=clRed;

    AddGanttColor(now,now+1,-1,'',clred);
  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