Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jakesee/ganttchart
The Winforms Gantt Chart is the .NET Winforms control originally hosted on CodePlex (http://ganttchart.codeplex.com)
https://github.com/jakesee/ganttchart
chart dotnet dotnet-framework gantt gantt-chart winforms winforms-controls
Last synced: 6 days ago
JSON representation
The Winforms Gantt Chart is the .NET Winforms control originally hosted on CodePlex (http://ganttchart.codeplex.com)
- Host: GitHub
- URL: https://github.com/jakesee/ganttchart
- Owner: jakesee
- License: mit
- Created: 2017-08-03T13:26:59.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-08-09T10:42:35.000Z (over 2 years ago)
- Last Synced: 2024-10-31T07:42:25.916Z (13 days ago)
- Topics: chart, dotnet, dotnet-framework, gantt, gantt-chart, winforms, winforms-controls
- Language: C#
- Homepage: https://jakesee.sg/net-c-winforms-gantt-chart-control/
- Size: 178 KB
- Stars: 177
- Watchers: 24
- Forks: 78
- Open Issues: 13
-
Metadata Files:
- Readme: readme.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
![](http://img.shields.io/badge/project%20status-stable%20and%20respond%20to%20queries-green.svg?style=flat) ![](http://img.shields.io/badge/license-MIT-red.svg?style=flat)
# .NET C# Winforms Gantt Chart Control
This .NET class library project provides a C# Winforms UserControl that draws a gantt chart using native GDI+.## Getting Started
The project is written with Microsoft Visual Studio 2017, simply download the latest source code from the master branch and build the library with the IDE.### Prerequisites
No pre-requisites other than the .NET Framework.### Installing
The project builds into a class library with example applications.## Running the tests
The source code includes a test project GanttChartTests which you can load and run within Microsoft Visual Studio 2017 from the test menu.## Features
* Support time units Weeks, Days (default), Hours out-of-the-box, can be modified to support other time resolutions.
* Single tasks, grouped tasks, precedent/dependant tasks, split tasks, tagged resources
* Printing respects page margin, orientation and multiple pages per page
* Percentage complete property for each task
* Various mouse events for customising UI experience directly on the chart.
* Comes with default mouse commands that can be overridden through inheritance.
* Determines critical path and slack# Documentation
Jump directly to the [doxygen documentation](http://www.jakesee.com/docs/ganttchart), or visit my [blog](http://www.jakesee.com/net-c-winforms-gantt-chart-control/) for more information. (Please make sure you are reading the updated versions while I try to keep up, thanks.)![](http://www.jakesee.com/codeplex/ganttchart.jpg)
## Basic Usage
### Create Chart and Adding Taskspublic Form1()
{
InitializeComponents();
var manager = new ProjectManager();
var task = new Task() { Name = "Hello World" };
manager.Add(task);
var chart = new Chart();
chart.Init(manage);
this.Controls.Add(chart);this.AutoScroll = true; // this is no longer required
}### Common Task Manipulation
You can manipulate the task through code using various methods in the ProjectManager:// Set task durations
_mManager.SetDuration(wake, 3);
// Give the Tasks some organisation, setting group and
// precedents e.g. make "wake" task a subtask under "work"
_mManager.Group(work, wake);
// Setting task dependencies e.g. make "wake" task a precedent of "brush teeth" task
_mManager.Relate(wake, teeth);
// Assigning Resources e.g. add "jake" resource to "wake" task
_mManager.Assign(wake, jake);
// splitting a tasks e.g. split the "pack up" task into 2 new tasks
_mManager.Split(pack, new MyTask(_mManager), new MyTask(_mManager), 2);
// set some tooltips to show the resources in each task
// e.g. set a tooltip on the "wake" task
_mChart.SetToolTip(wake, string.Join(", ", _mManager.ResourcesOf(wake).Select(x => (x as MyResource).Name)));### Custom Task Data: Different colors for every tasks
You can change the default task appearance for all task, or as in here change individual task color as a demo for adding custom business data to tasks.public partial class ExampleSimple : Form
{
ProjectManager _mProject;
public ExampleSimple()
{
InitializeComponent();
_mProject = new ProjectManager();
_mProject.Add(new Task() { Name = "New Task" });
_mProject.Add(new ColoredTask() { Name = "Purple Task", Color = Color.Purple });
_mProject.Add(new ColoredTask() { Name = "Gold Task", Color = Color.Gold });
_mChart.Init(_mProject);
// Custom behavior on paint task
_mChart.PaintTask += (s, e) =>
{
ColoredTask ctask = e.Task as ColoredTask;
if (ctask != null)
{
var format = new TaskFormat();
format = e.Format;
format.BackFill = new SolidBrush(ctask.Color);
e.Format = format;
}
};
// Grab custom data for tasks
_mChart.TaskSelected += (s, e) =>
{
ColoredTask ctask = e.Task as ColoredTask;
if (ctask != null)
{
MessageBox.Show("Selected " + ctask.Color.ToString());
}
};
}
}// Custom task with business data
public class ColoredTask : Task
{
public ColoredTask() : base() {}
public Color Color { get; set; }
}
## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details