GanttView
Wisej.NET 4.2.0+
The GanttView draws a project plan: a task list on the left and, beside it, one bar per task on a time scale, with completion filled in, finish-to-start dependencies drawn as arrows and milestones as diamonds. Users move bars to reschedule, drag their ends to change duration, drag the completion handle to report progress and draw links between tasks, and every one of those edits reaches the server as a cancellable event before it is committed.
Use it wherever work has dates and an order: project plans, production runs, onboarding schedules, maintenance windows. For appointments in a calendar grid use a SchedulerView; for work that moves through stages rather than along dates, a KanbanBoard.
For a complete list of properties, methods, and events, see the API documentation.
Features
Tasks
Each row is a GanttTask in the Tasks collection. A task has an Id that identifies it, a Text, a Start and an End date, a Progress percentage from 0 to 100 and a Tone (a MeterTone) for the colour of its bar. Setting Milestone draws the task as a diamond on its Start date. Tag keeps any object of yours on the server.
Dates are calendar dates without times or time zones, and End is exclusive: a task from Monday to the following Monday lasts five working days, not six. Use RescheduleTask to change both dates of an existing task in one step.
this.ganttView1.Tasks.Add(new GanttTask
{
Id = "survey",
Text = "Site survey",
Start = new DateTime(2026, 3, 2),
End = new DateTime(2026, 3, 7),
Progress = 100,
Tone = MeterTone.Success
});
Hierarchy and Dependencies
ParentId names the task a row belongs to, which turns the list into a tree; SetExpanded(task, expanded) and ExpandAll() open and close the branches. Summary rows do not add up the dates of their children — set them yourself.
DependsOn lists the ids of the tasks that must finish before this one starts. The collection rejects duplicate ids, self-links and cycles as soon as you add a task, and AddDependency(predecessor, successor) adds a link from code with the same checks. With CriticalPath on, the tasks with no slack are underlined; GetCriticalTaskIds() returns them.
Time Scale and Work Calendar
TimeScale sets the header: Days, Weeks (ISO week numbers, the default) or Months. ShowToday draws a marker on the current date, and ScrollTo(date) brings a date into view. TaskListWidth sets the width of the task list in pixels.
WorkCalendar is the GanttWorkCalendar that defines which days count. Weekends lists the non-working weekdays (Saturday and Sunday by default) and Holidays the non-working dates. Non-working days are shaded, a moved bar keeps its number of working days, and the calendar's own IsWorkingDay, WorkingDays, NextWorkingDay and AddWorkingDays methods are there for your scheduling code.
this.ganttView1.TimeScale = GanttTimeScale.Days;
this.ganttView1.WorkCalendar.Holidays = new[]
{
new DateTime(2026, 4, 3), new DateTime(2026, 4, 6)
};
Editing and Events
AllowDrag, AllowResize and AllowLink turn the three kinds of edit on and off, and ShowProgress shows the completion fill and its handle. The bar follows the pointer in the browser; nothing reaches the server until the user lets go. Then:
| Event | Raised when | Event data |
|---|---|---|
TaskMoving | Before a move, resize or progress change is committed. Set Cancel to reject it. | GanttTaskChangeEventArgs: Task, Start, End, Progress, Operation |
TaskMoved | After an accepted move. | GanttTaskChangeEventArgs |
TaskResized | After an accepted resize. | GanttTaskChangeEventArgs |
ProgressChanged | After an accepted change of completion. | GanttTaskChangeEventArgs |
DependencyCreated | Before a link drawn by the user is committed. Set Cancel to reject it. | GanttDependencyEventArgs: Predecessor, Successor |
TaskClick, TaskDoubleClick | A task is clicked or double-clicked. | GanttTaskEventArgs: Task |
Operation is "Move", "Resize" or "Progress". The same edits are available from code: RescheduleTask, SetTaskProgress and AddDependency raise the same events and return false when the edit is rejected.
Data Binding
Instead of filling Tasks, set DataSource to a list, an IListSource or a BindingSource, and the view builds the tasks from it. The members it reads default to the GanttTask property names — Id, Text, Start, End, Progress, Tone, Milestone, ParentId, DependsOn — and each has a …Member property to map another name. Edits made by the user are written back to the mapped properties of the record, which must therefore be writable, and each bound task's Tag is its record. A source that raises ListChanged refreshes the view; otherwise call RefreshData().
How To
Build a Plan in Code
var start = new DateTime(2026, 3, 2);
this.ganttView1.Tasks.Add(new GanttTask { Id = "rollout", Text = "Warehouse rollout", Start = start, End = start.AddDays(33) });
this.ganttView1.Tasks.Add(new GanttTask { Id = "survey", ParentId = "rollout", Text = "Site survey", Start = start, End = start.AddDays(5), Progress = 100 });
this.ganttView1.Tasks.Add(new GanttTask { Id = "racking", ParentId = "rollout", Text = "Install racking", Start = start.AddDays(7), End = start.AddDays(19), Progress = 40, DependsOn = new[] { "survey" } });
this.ganttView1.Tasks.Add(new GanttTask { Id = "scanners", ParentId = "rollout", Text = "Configure scanners", Start = start.AddDays(14), End = start.AddDays(26), Tone = MeterTone.Warning, DependsOn = new[] { "survey" } });
this.ganttView1.Tasks.Add(new GanttTask { Id = "golive", ParentId = "rollout", Text = "Go live", Start = start.AddDays(28), Milestone = true, DependsOn = new[] { "racking", "scanners" } });
this.ganttView1.CriticalPath = true;
this.ganttView1.ScrollTo(start);
Bind to Your Records
this.ganttView1.IdMember = "TaskNo";
this.ganttView1.TextMember = "Title";
this.ganttView1.StartMember = "PlannedStart";
this.ganttView1.EndMember = "PlannedEnd";
this.ganttView1.ProgressMember = "PercentDone";
this.ganttView1.DataSource = new BindingList<ProjectTask>(db.ProjectTasks.ToList());
Validate an Edit
Reject a change before it is committed: here, nothing may be scheduled into a frozen period, and a task cannot be marked complete while its checklist is open.
private void ganttView1_TaskMoving(object sender, GanttTaskChangeEventArgs e)
{
if (e.Operation != "Progress" && e.Start < this.freezeUntil)
{
e.Cancel = true;
AlertBox.Show($"Nothing can start before {this.freezeUntil:d}.");
}
else if (e.Operation == "Progress" && e.Progress == 100 && ((ProjectTask)e.Task.Tag).OpenChecks > 0)
{
e.Cancel = true;
}
}
Advanced
JavaScript Widget
| Item | Description |
|---|---|
| Class name | "wisej.web.GanttView" |
| Theme appearance | "ganttview", see Themes. Its properties include the grid, weekend and marker colours and the five bar colours, one per MeterTone. |
| Child components | "scroll" is the scrollable viewport. "chart" is the HTML element that draws the task list, the time scale and the bars. See JavaScript. |