Page 1 of 1

problems with TGanttSeries and LeftAxis Labels

Posted: Tue Dec 04, 2012 10:08 am
by 16462341
Hi,

When making the code below, The marks seems to interfere with the LeftAxis Labels. I have attached a figure illustraing the problem. How can I avoid that??

Code: Select all

procedure TForm10.FormShow(Sender: TObject);
var
  I: Integer;
begin

Chart1.View3D := false;

     with Chart1.AddSeries(TGanttSeries.Create(self)) as TGanttSeries do
        begin
          ParentChart := Chart1;
          ShowInLegend := true;
          XValues.Order:=loNone;
          ShowInLegend := false;
          Marks.visible := true;
          Marks.Transparent := true;
          Xvalues.DateTime := true;
        end;

      for I := 0 to 9 do
        with Chart1[Chart1.SeriesCount -1] as TGanttSeries do
          begin
            Pointer.VertSize:=10;
            AddGanttcolor(now-5-i,now-5+i,i div 2,'',clred);
          end;

chart1.BottomAxis.SetMinMax(now-5,now+10);
end;

Re: problems with TGanttSeries and LeftAxis Labels

Posted: Tue Dec 04, 2012 10:09 am
by 16462341
The problem seems to be related to the problem with

Code: Select all

Marks.Transparent := true;

Re: problems with TGanttSeries and LeftAxis Labels

Posted: Tue Dec 04, 2012 2:33 pm
by yeray
Hi,
Friis wrote:How can I avoid that??
It depends. How do you want to avoid that?
- Do you want the left axis labels not to be drawn? You can hide them setting a blank space in the string given at the OnGetAxisLabel event. Here it is a .NET example, but the same applies to VCL.
- Do you want the gantt marks to be drawn elsewhere? You can set a different bottom axis scale, or you can manually set the marks positions as shown here.

Re: problems with TGanttSeries and LeftAxis Labels

Posted: Tue Dec 04, 2012 3:07 pm
by 16462341
Hi Yeray,

Actually, what I would like is that, that part of the marks that are "outside" of the Chart area is not being shown. So that the area with the Left Axis Labels does not show the marks at all.

Re: problems with TGanttSeries and LeftAxis Labels

Posted: Tue Dec 04, 2012 3:42 pm
by yeray
Hi Friis,

This is a clipping, isn't it? There's a property for it: Marks.Clip

Code: Select all

  with Chart1.AddSeries(TGanttSeries) as TGanttSeries do
  begin
    ParentChart := Chart1;
    ShowInLegend := true;
    XValues.Order:=loNone;
    ShowInLegend := false;
    Marks.visible := true;
    Marks.Transparent := true;
    Xvalues.DateTime := true;
    OnGetMarkText:=GetMarkText;
    Marks.Clip:=true;
  end;

Re: problems with TGanttSeries and LeftAxis Labels

Posted: Wed Dec 05, 2012 12:50 pm
by 16462341
Hi Yeray,

I didn't know that property existed - Thank you; it works fantatsic know :D