Gantt Charts

C1Chart implements Gantt charts, which show tasks organized along time.

Gantt charts use data series objects of type HighLowSeries. Each data series represents a single task, and each task has a set of start and end values. Simple tasks have one start value and one end value. Tasks that are composed of multiple sequential sub-tasks have multiple pairs of start and end values.

To demonstrate Gantt charts, let us start by defining a Task object:

      C#

Next, let us define a method that creates a set of Task objects that will be shown as a Gantt chart:

      C#

Now that the tasks have been created, we are ready to create the Gantt chart:

      C#

After clearing the C1Chart and setting the chart type, the code enumerates the tasks and creates one HighLowSeries for each. In addition to setting the series Label, LowValuesSource and HighValuesSource properties, the code uses the SymbolSize property to set the height of each bar. In this sample, we define some tasks as "Group" tasks, and make them taller than regular tasks.

Next, we use a LINQ statement to extract the task names and assign them to the ItemNames property. This causes C1Chart to display the task names along the Y axis.

Finally, the code customizes the axes. The Y axis is reversed so the first task appears at the top of the chart. The axes are configured to show vertical grid lines and alternating bands.

The final result looks like this:

 


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.