Page 1 of 1

TGantt Problem

Posted: Fri Nov 09, 2012 3:00 pm
by 16462341
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;

Re: TGantt Problem

Posted: Fri Nov 09, 2012 4:17 pm
by yeray
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;