Page 1 of 1

TGantt issue

Posted: Mon Nov 05, 2012 8:27 am
by 16462341
Hi,

How do I access the individual TGantt point so that I can change the brush, linepen etc??

In the attached photo I would like to give the individual point a different brush color instead of red and different line pen colors instead of just black

Re: TGantt issue

Posted: Mon Nov 05, 2012 12:55 pm
by yeray
Hello,

For the brush, you can set a color when you add the point with the AddGanttColor method that requires a Color as an argument.
Alternatively, you can change a point color after populating the series, ie:

Code: Select all

Series1.ValueColor[3]:=clWhite;
To change a point border line is a bit tricky because it is a unique property for the whole series, not for each point.
You could use the OnGetPointerStyle event to change the series' line pen for each point. Ie:

Code: Select all

function TForm1.Series1GetPointerStyle(Sender: TChartSeries;
  ValueIndex: Integer): TSeriesPointerStyle;
begin
  with (Sender as TGanttSeries).Pointer do
    if (ValueIndex = 2) then
      Pen.Color:=clRed
    else
      Pen.Color:=clBlack;

  Result:=psRectangle;
end;