Home > Sample Charts > GanttChart > A Simple Activity Schedule

A Simple Activity Schedule

Gantt charts were originally devised as a graphical way to show the relationship between activites in a project plan, and have been made very popular by tools such as MS Project. The chart shows time progressing from left to right, with each activity drawn as a colored bar, and generally labelled with its name.

This example shows four activities planned by week-number. The activity names have been used as axis labels here, but note that you must provide one label per tick-mark, so there is an extra dummy label to go opposite the X-axis. The left-margin will usually need to be made a little wider, even if the labels are wrapped into a preset width (as here).


SharpPlot sp = new SharpPlot;
sp.Heading = "Work Schedule";
todo = new string[]{"","Clear ground","Dig drains","Lay foundations","Concrete floors"};
sp.SetYLabels(todo);

startwk = new int[] {24,28,34,50};
endwk = new int[] {30,36,48,54};
ydata = new int[] {1,2,3,4};

sp.MarginLeft = 72;
sp.YAxisStyle = YAxisStyles.ForceZero|YAxisStyles.GridLines;
sp.SetXTickMarks(5);

sp.DrawGanttChart(ydata,startwk,endwk);

Worked Examples

ganttchart1 ganttchart2 ganttchart3 ganttchart4

Send comments on this topic
© Dyalog Ltd 2013