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
Gantt Chart - Adding a "Today" line
-
- Newbie
- Posts: 11
- Joined: Tue Aug 24, 2004 4:00 am
Hi MAt,
you can do this by using the canvas techniques or using a ColorLineTool :
i.e. :
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;
Pep Jorge
http://support.steema.com
http://support.steema.com
-
- Newbie
- Posts: 11
- Joined: Tue Aug 24, 2004 4:00 am
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
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
Hi, Matt.
ColorLineTool has to be connected to specific axis, in your case series horizontal axis (chart bottom axis ?). The following code should do the trick:Are then any properties I should be setting on the color line tool ?
Code: Select all
colorlineTool1.AllowDrag := False;
colorlineTool1.DragRepaint := False;
colorlineTool1.Axis := Series1.GetHorizAxis;
colorlineTool1.Value := Date;
colorLineTool1.Pen.Width := 2;
colorLineTool1.Pen.Color := clRed;
Marjan Slatinek,
http://www.steema.com
http://www.steema.com