Page 1 of 1

Bug (or missing feature....) in Gantt chart series

Posted: Wed Mar 30, 2005 11:56 am
by 8573088
Hi,

We use quite a few times Teechart to produce diagrams. Since today, we need to use a gantt chart. (Using version 6.01 with source).

I've encountered a bug (or a missing feature if you like):

To connect two 'Gantt points' one can use:

Series.AddGant( 0, 12, 0, 'something');
Series.AddGant( 14, 15, 1, 'after something');

Series.NextTask[0] := 1; // links the first point to the second point

However, adding another gant

Series.AddGant( 13, 20, 1)

will cause the 'GanttPoints' to be rearranged. The first entry is still at position 0, the second entry is now at position 2, and the third entry is at position 1.

Unfortunately, the NextTask references are NOT updated. !

This should be fixed in the next version (if not already).


A workaround would be to first order all points and then add them. However, everyone using them should also figure out what the behaviour would be for each possible addition. (Troublesome if you dont have the source) meaning what happens when I do this:

Series.AddGant( 0, 12, 0, 'something');
Series.AddGant( 14, 15, 0);
Series.AddGant( 14, 12, 1);

etc etc.


Grtz,

Marck

Posted: Wed Mar 30, 2005 1:38 pm
by narcis
Hi Marck,

I've been able to reproduce what you report, but noticed that only happens if you the newly added Gantt bar occupies the position (smaller start coordinate and greater end coordinate) of an existing bar as in the case you mentioned. Try the code below to see this behaviour.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.AddGantt( 0, 12, 0, 'something');
  Series1.AddGantt( 14, 17, 1, 'after something');

  Series1.NextTask[0] := 1; // links the first point to the second point

  Series1.Marks.Visible:=true;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Series1.AddGantt( 13, 20, 1);
end;

procedure TForm1.Series1GetMarkText(Sender: TChartSeries;
  ValueIndex: Integer; var MarkText: String);
begin
  MarkText:=IntToStr(ValueIndex);
end;
I have also added this problem to our defect list to be fixed for future releases.

Posted: Wed Mar 30, 2005 2:07 pm
by 8573088
Thank you :)

fixed?

Posted: Thu Mar 02, 2006 3:47 pm
by 9530384
If I make an 'addGantt' I use the return values as index for the 'NextTask' property. But the lines seem to be connected randomly. So I wanted to ask if it is wrong to use the return value of the 'addGantt' function or if this bug still isnt fixed in the latest version?

thank you

Posted: Thu Mar 02, 2006 4:15 pm
by narcis
Hi AHIS,

It works fine here using latest version available, which is v7.06, and this code:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i1,i2: Integer;
begin
  i1:=Series1.AddGantt(EncodeDateTime(2006,3,2,17,0,0,0),EncodeDateTime(2006,3,12,17,0,0,0),1);
  i2:=Series1.AddGantt(EncodeDateTime(2006,3,22,17,0,0,0),EncodeDateTime(2006,4,12,17,0,0,0),2);

  Series1.NextTask[i1]:=i2;
end;

Posted: Fri Mar 03, 2006 8:12 am
by 9530384
narcis wrote:Hi AHIS,

It works fine here using latest version available, which is v7.06, and this code:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i1,i2: Integer;
begin
  i1:=Series1.AddGantt(EncodeDateTime(2006,3,2,17,0,0,0),EncodeDateTime(2006,3,12,17,0,0,0),1);
  i2:=Series1.AddGantt(EncodeDateTime(2006,3,22,17,0,0,0),EncodeDateTime(2006,4,12,17,0,0,0),2);

  Series1.NextTask[i1]:=i2;
end;
Hi Narcis.

With the short code you supplied it should be ok, but what happenes if you try it like above? Because you mentioned that the error only occures if
narcis wrote: the newly added Gantt bar occupies the position (smaller start coordinate and greater end coordinate) of an existing bar
?

greetings

announce: newsgroup post

Posted: Fri Mar 03, 2006 12:38 pm
by 9530384
I'm gonna post into steema.public.attachments 4 images to make my problem clear. (Topic 'Bug (or missing feature....) in Gantt chart series').

thanks

SOLUTION

Posted: Wed May 03, 2006 12:01 pm
by 9530384
By chance 2 months after my last post I found the solution to my problem myself:

TChart automatically sorts points in ascending order. So if I enter a new Point between existing Points all indices are changed due to this fact. What I didnt knew was that this is a feature and not a bug and you can actually disable it!

TChart1.Series().XValues.Order = 0
TChart1.Series().YValues.Order = 0

A shame that nobody at Steema could come up with this solution!!!

greetings.