I want to improve on the data aware gantt's very basic functionality. I want to be able to change the color of the bar based on it status, which is provided in the data record along with its name, begin date and end date.
Also I want to find out if it is possible to make a "Project Bar" that automatically adjusts start and end dates based on the start and end dates of subordinate "Task Bars".
Thanks
db aware Gantt - Basic Questions
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi CAC,
You'll find more information on how to use series with databases at Tutorial 8 - Database access. You'll find the
tutorials at TeeChart's program group.
Yes, you can do that using ColorSource property, for example:I want to improve on the data aware gantt's very basic functionality. I want to be able to change the color of the bar
based on it status, which is provided in the data record along with its name, begin date and end date.
Code: Select all
with Series1 do
begin
YValues.ValueSource := 'Value';
XLabelsSource := 'Text';
ColorSource:='Color';
DataSource := Table1;
end;
tutorials at TeeChart's program group.
You can achieve that doing something like this:Also I want to find out if it is possible to make a "Project Bar" that automatically adjusts start and end dates based
on the start and end dates of subordinate "Task Bars".
Code: Select all
procedure TForm8.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues();
DrawTaskBars;
end;
procedure TForm8.DrawTaskBars;
var
Start: Boolean;
count, i, j, tmpIndex: Integer;
tmpStart, tmpEnd: Double;
ProjectSeries: TGanttSeries;
begin
ProjectSeries:=TGanttSeries.Create(self);
ProjectSeries.Marks.Visible:=true;
ProjectSeries.Marks.Frame.Visible:=false;
ProjectSEries.Marks.Brush.Style:=bsClear;
Chart1.AddSeries(ProjectSeries);
count := 1;
for i := 0 to Series1.Count - 1 do
begin
Start := true;
for j := 0 to Series1.Count - 1 do
begin
if Series1.NextTask[j] = i then
begin
Start := false;
break;
end;
end;
if Start then
begin
tmpStart := Series1.StartValues[i];
tmpIndex := i;
while Series1.NextTask[tmpIndex] <> -1 do
tmpIndex := Trunc(Series1.NextTask[tmpIndex]);
tmpEnd := Series1.EndValues[tmpIndex];
ProjectSeries.AddGantt(tmpStart, tmpEnd, Series1.Count + ProjectSeries.Count, 'Project ' + IntToStr(count));
inc(count);
end;
end;
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 |
Instructions - How to post in this forum |