Gantt
TsgcHTMLComponent_Gantt — 渲染甘特项目时间线图表,带有彩色任务条和进度填充,适用于 Delphi、C++ Builder 和 .NET。
TsgcHTMLComponent_Gantt — 渲染甘特项目时间线图表,带有彩色任务条和进度填充,适用于 Delphi、C++ Builder 和 .NET。
添加带有起止日期和进度百分比的任务,设置标题,然后读取 HTML 属性 — 组件会在整个项目范围内缩放每个任务条。
TsgcHTMLComponent_Gantt
带有任务条的 Bootstrap 5 卡片 + 作用域 CSS
Delphi, C++ Builder, .NET
设置 Title,为每个工作项调用 AddTask(带有其日期、进度和颜色),然后读取 HTML。
uses
sgcHTML_Enums, sgcHTML_Component_Gantt;
var
oGantt: TsgcHTMLComponent_Gantt;
begin
oGantt := TsgcHTMLComponent_Gantt.Create(nil);
try
oGantt.Title := 'Release Plan';
oGantt.AddTask('Design', EncodeDate(2026, 6, 1),
EncodeDate(2026, 6, 7), 100, hcPrimary, 'Ana');
oGantt.AddTask('Build', EncodeDate(2026, 6, 8),
EncodeDate(2026, 6, 20), 45, hcSuccess, 'Tom');
WebModule.Response := oGantt.HTML; // card + task bars + CSS
finally
oGantt.Free;
end;
end;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Gantt.hpp
TsgcHTMLComponent_Gantt *oGantt = new TsgcHTMLComponent_Gantt(NULL);
try
{
oGantt->Title = "Release Plan";
oGantt->AddTask("Design", EncodeDate(2026, 6, 1),
EncodeDate(2026, 6, 7), 100, hcPrimary, "Ana");
oGantt->AddTask("Build", EncodeDate(2026, 6, 8),
EncodeDate(2026, 6, 20), 45, hcSuccess, "Tom");
String html = oGantt->HTML; // card + task bars + CSS
}
__finally
{
delete oGantt;
}
using esegece.sgcWebSockets;
var gantt = new TsgcHTMLComponent_Gantt();
gantt.Title = "Release Plan";
gantt.AddTask("Design", new DateTime(2026, 6, 1),
new DateTime(2026, 6, 7), 100, TsgcHTMLColor.hcPrimary, "Ana");
gantt.AddTask("Build", new DateTime(2026, 6, 8),
new DateTime(2026, 6, 20), 45, TsgcHTMLColor.hcSuccess, "Tom");
string html = gantt.HTML; // card + task bars + CSS
您最常使用的成员。
Tasks 保存带有 Title、StartDate、EndDate、Progress、枚举 Color 和 Assignee 的工作项。
AddTask(aTitle, aStart, aEnd, aProgress, aColor, aAssignee) 通过单个调用追加一个任务条。
组件会找出所有任务中最早的开始时间和最晚的结束时间,并在该范围内按比例定位每个任务条。
每个任务的 Progress(0–100)在其任务条上绘制一个半透明填充,让完成情况一目了然。
Title 在图表上方渲染粗体标题;留空则去掉标题行。
GanttID 标识卡片;HTML 返回卡片、任务行和作用域甘特 CSS。