A newer version of this page is available. Switch to the current version.

Gantt Diagram

  • 3 minutes to read

This document details the specifics of the Gantt diagram type. It lists the series view types associated with this diagram type, demonstrates how its specific options can be accessed (both at design and runtime), and briefly describes these options. Before reading this text, you may wish to review the basics of using diagram in the ASP.NET Chart Control.

This document consists of the following sections.

Associated Series View Types

The Gantt diagram is used to plot series of the Side-by-Side and Overlapped Gantt view types. These views display horizontal bars along the date-time axis. Each bar represents a separate event with start and end values, so these charts are used to track different activities during the time frame (e.g. plan the use of various resources, review the project’s completion in project management, etc.). This chart type is useful when it is necessary to show activity bars from different series one above another, to compare their duration. You can freely combine series of these view types within the same diagram.

A typical example of the Gantt diagram is shown in the following image.



Since it is common for Gantt charts to show the date-time axis (axis of values) horizontally, the Gantt chart cannot be rotated. Therefore, the GanttDiagram.Rotated property for the GanttDiagram is hidden and unavailable.

To learn how to access the Gantt diagram and its options, refer to the next section of this document.

Accessing a Diagram

To access the Gantt diagram’s options at design time, click your chart, to select it. Then, expand the WebChartControl.Diagram property in the Properties window.

At runtime, cast your instance of the Diagram object to the GanttDiagram type.

// Create a new ChartControl instance.
ChartControl chart = new ChartControl();

// Create a series of the compatible view type, 
// and add it to the chart's collection,
// so the diagram object shall not to be equal to null.
Series series1 = new Series("Gantt Series 1", ViewType.Gantt);

// Create a diagram, and cast it to the GanttDiagram type.
GanttDiagram diagram = (GanttDiagram)chart.Diagram;

Specific Options

Since the GanttDiagram class is derived from the XYDiagram class, its set of properties is similar to the properties of the XY-Diagram. The only difference is that the GanttDiagram.Rotated property is hidden, and its value is always equal to true.

So, taking this sole difference into consideration, you can refer to the list of available options in the following document: XY-Diagram.