SharpPlot Reference > SharpPlot Methods > DrawGanttChart Method

SharpPlot.DrawGanttChart Method

Construct a horizontal Gantt chart from schedule data (activities and times).


sp = new SharpPlot(180,120);
sp.SetColors(new Color[]{Color.OrangeRed,Color.ForestGreen});
sp.SetYLabels(new string[]{"Cut","Polish","Pack"});
sp.SetYTickMarks(new double[] {0.5,1.5,2.5,3.5});
process = new int[] {1,1,2,2,2,3,3};
start = new int[] {24,28,25,29,35,29,42};
end = new int[] {28,32,29,33,40,30,44};
done = new bool[]{true,false,true,false,false,true,false};
sp.YAxisStyle = YAxisStyles.MiddleLabels|YAxisStyles.GridLines;
sp.KeyStyle = KeyStyles.NoKey;

The short tutorial shows a few of the possibilities and some sample code.



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. The Y-axis shows some higher-level grouping of related tasks.

This style of chart also works very well as a way to show a production schedule (machines are shown on the Y-axis) or to record the output from any kind of logging system.

See also ...

Gantt charts for timewise bars | SharpPlot Members | SharpPlot.GanttChartStyle Property

Send comments on this topic
© Dyalog Ltd 2016