gant chart used with seconds rather then days?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
kevino
Newbie
Newbie
Posts: 6
Joined: Mon May 16, 2011 12:00 am

gant chart used with seconds rather then days?

Post by kevino » Mon Nov 07, 2011 3:46 am

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

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: gant chart used with seconds rather then days?

Post by Yeray » Mon Nov 07, 2011 11:08 am

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
Gantt.png (7.34 KiB) Viewed 2951 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;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply