You could draw the TGanttSeries
at OnBeforeDrawAxes
, then hide it at OnBeforeDrawSeries
and finally make it visible again at OnAfterDraw
for the next drawing cycle:
type
TForm1 = class(TForm)
Chart1: TChart;
Series1: TGanttSeries;
Series2: TLineSeries;
procedure FormCreate(Sender: TObject);
procedure Chart1BeforeDrawAxes(Sender: TObject);
procedure Chart1BeforeDrawSeries(Sender: TObject);
procedure Chart1AfterDraw(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type TCustomSeriesAccess=class(TCustomSeries);
procedure TForm1.Chart1BeforeDrawAxes(Sender: TObject);
begin
TCustomSeriesAccess(Series1).DrawAllValues;
end;
procedure TForm1.Chart1BeforeDrawSeries(Sender: TObject);
begin
Series1.Visible:=False;
end;
procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
Series1.Visible:=True;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.Draw;
end;