Page 1 of 1

Writing Gantt valuies back to database

Posted: Thu Feb 26, 2009 4:30 pm
by 10546864
I am using TdbChart and the Gantt Series. I am also using the Gantt Drag tool. Series data is a bound to a Datesource to a MS/SQL query. (TadoQuery)

The Gantts are on a time line. All the Gantts are in one series.

I want my user to be able to move/resize the Gantts interactively and have the values write back to the database. How do I do this?
Thanks

Delphi 2006 Win32
Tchart 8.02 VCL

Posted: Fri Feb 27, 2009 11:01 am
by yeray
Hi SpringerRider,

I think you should use OnResizeBar and OnDragBar events to retrieve the new gantt values and do your sql queries. Here is how you could obtain the modified values in these events:

Code: Select all

procedure TForm1.ChartTool1DragBar(Sender: TGanttTool; GanttBar: Integer);
begin
  Chart1.Title.Text[0] := 'Bar Num: ' + inttostr(GanttBar) + '  StartValue: ' + FormatDateTime('c',Series1.StartValues[GanttBar]) + '  EndValue: ' + FormatDateTime('c', Series1.EndValues[GanttBar]);
end;

procedure TForm1.ChartTool1ResizeBar(Sender: TGanttTool; GanttBar: Integer;
  BarPart: TGanttToolBarPart);
begin
  Chart1.Title.Text[0] := 'Bar Num: ' + inttostr(GanttBar) + '  StartValue: ' + FormatDateTime('c', Series1.StartValues[GanttBar]) + '  EndValue: ' + FormatDateTime('c', Series1.EndValues[GanttBar]);
end;

Posted: Fri Feb 27, 2009 1:41 pm
by 10546864
Thanks Yeray,
That works