| |||||
Introducing SharpPlot Your First Chart Recent Updates Tutorials General Tutorials Chart Tutorials Reference SharpPlot Class Properties Methods Structures Enumerations Style examples Glossaries Active Charts VectorMath Class DBUtil Class Get SharpPlot Download SharpPlot Buying SharpPlot SharpPlot Support Upgrading from GraPL Release notes |
Home > Sample Charts > GanttChart > A Simple Activity Schedule A Simple Activity ScheduleGantt 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 |