Page 1 of 1
gant chart used with seconds rather then days?
Posted: Mon Nov 07, 2011 3:46 am
by 16859341
I have a need to create a gant looking chart for a series of of data points that are measured in seconds and span no more then 3 minutes. I tried manually adding some data, but the end date seems to always want to be an actual date. Is there a way to create a gant style chart with a series of 10 or so bars each back to back horizontally but only lasting a few seconds? thanks
Re: gant chart used with seconds rather then days?
Posted: Mon Nov 07, 2011 11:08 am
by yeray
Hello,
The AddGantt method allows you to add each value with start and end date. You could use it to add your values with an end date a few seconds greater than the start date. Here you have an example using it:
- Gantt.png (7.34 KiB) Viewed 2985 times
Code: Select all
uses GanttCh, DateUtils;
procedure TForm1.FormCreate(Sender: TObject);
var tmpDate: TDateTime;
i: Integer;
begin
Chart1.View3D:=false;
Chart1.Legend.TextStyle:=ltsPlain;
tmpDate:=StrToDateTime('01/01/2011 8:00:00');
with Chart1.AddSeries(TGanttSeries) as TGanttSeries do
begin
for i:=0 to 5 do
begin
AddGantt(tmpDate,IncSecond(tmpDate,10),random(5), 'val nÂș' + IntToStr(i));
tmpDate:=IncSecond(tmpDate,30);
end;
end;
Chart1.Axes.Bottom.LabelsAngle:=90;
Chart1.Axes.Bottom.DateTimeFormat:='hh:mm:ss';
Chart1.Axes.Bottom.Increment:=DateTimeStep[dtTenSeconds];
Chart1.Axes.Left.LabelStyle:=talValue;
end;