Page 1 of 1
Gantt Chart - Adding a "Today" line
Posted: Thu Sep 02, 2004 1:35 pm
by 9233711
I've got a basic gantt chart that spreads across 1 year, with every 2 weeks marked on the x axis.
Basically, I want to remind the users what the current day position is. I want to do this by simply drawing a vertical line (or heavy grid line), at the point of todays date, stretching up through the chart.
How can I do this ?
regards
Mat Dunning
Posted: Thu Sep 02, 2004 1:56 pm
by Pep
Hi MAt,
you can do this by using the canvas techniques or using a ColorLineTool :
i.e. :
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var day : TDate;
i : integer;
begin
day := Today;
for i := -2 to 2 do
Series1.AddXY(day+i,Random(100),'',clteecolor);
Series1.XValues.DateTime := true;
ChartTool1.Value := day;
end;
Posted: Mon Sep 06, 2004 10:46 am
by 9233711
thanks for the quick reply. I've use the code you provided (but I must be doing something wrong), as this draws another small block on the Gantt, where "today" is, but what I want is a single line going from top to bottom showing where today is.
If I had the Random statement in the code, it simply drew this block "off" the gantt chart so I couldn't see it.
I can see you are using a color line chart tool, but i'm not sure how this is used in this case? Are then any properties I should be setting on the color line tool ?
regards
Mat
Posted: Mon Sep 06, 2004 10:56 am
by Marjan
Hi, Matt.
Are then any properties I should be setting on the color line tool ?
ColorLineTool has to be connected to specific axis, in your case series horizontal axis (chart bottom axis ?). The following code should do the trick:
Code: Select all
colorlineTool1.AllowDrag := False;
colorlineTool1.DragRepaint := False;
colorlineTool1.Axis := Series1.GetHorizAxis;
colorlineTool1.Value := Date;
colorLineTool1.Pen.Width := 2;
colorLineTool1.Pen.Color := clRed;