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

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Marck
Newbie
Newbie
Posts: 6
Joined: Fri Dec 13, 2002 5:00 am
Location: Netherlands

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

Post by Marck » Wed Mar 30, 2005 11:56 am

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Mar 30, 2005 1:38 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Marck
Newbie
Newbie
Posts: 6
Joined: Fri Dec 13, 2002 5:00 am
Location: Netherlands

Post by Marck » Wed Mar 30, 2005 2:07 pm

Thank you :)

AHIS
Newbie
Newbie
Posts: 19
Joined: Wed Feb 22, 2006 12:00 am
Location: Austria

fixed?

Post by AHIS » Thu Mar 02, 2006 3:47 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Mar 02, 2006 4:15 pm

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;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

AHIS
Newbie
Newbie
Posts: 19
Joined: Wed Feb 22, 2006 12:00 am
Location: Austria

Post by AHIS » Fri Mar 03, 2006 8:12 am

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

AHIS
Newbie
Newbie
Posts: 19
Joined: Wed Feb 22, 2006 12:00 am
Location: Austria

announce: newsgroup post

Post by AHIS » Fri Mar 03, 2006 12:38 pm

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

AHIS
Newbie
Newbie
Posts: 19
Joined: Wed Feb 22, 2006 12:00 am
Location: Austria

SOLUTION

Post by AHIS » Wed May 03, 2006 12:01 pm

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.

Post Reply