How to Create a Gantt Chart in VB Using a Graph Custom ControlLast reviewed: June 21, 1995Article ID: Q112650 |
The information in this article applies to:
- Professional Edition of Microsoft Visual Basic for Windows, version 3.0
SUMMARYA Gantt chart is a horizontal bar chart used for project planning and reporting. The Graph custom control that comes with the Professional Edition of Visual Basic for Windows can be used to create a Gantt chart. This article shows by examnple how to create a Gantt chart.
MORE INFORMATIONTo create a Gantt chart using the Graph custom control, you need to know how many bars your graph will require. Typically this includes one project bar and several activity bars. You will also need to know the number of sections required in each bar. Typically each bar is divided into two sections -- one to show actual progress on the project, the other to show plans for the time remaining. In the graph custom control, NumPoints represents the number of horizontal bars needed, so the following is true:
NumSets = (Number of Bars) * (Sections on a Bar) or NumSets = NumPoints * (typically 2)To make the graph more readable, you can set the range of the horizontal axis using YAxisStylealong with YAxisMax. To place tick marks, use YAxisTicks. To clear previous data assigned to the graph, use DataReset. To plot the bars on the graph, you need to assign values to the GraphData property of Graph1. GraphData values that follow ThisSet = 1 assignment indicate the beginning of the section on a bar, and the corresponding GraphData values following the ThisSet = 2 assignment, indicate the end of the section. For example: To plot the following Gantt chart:
| 5 7 11 1 | [------------]<--------------> | | 6 8 15 2 | [-----------]< ---------------------> | |__________________________________________________Make the following assignments:
Graph1.ThisSet = 1 ' Beginning of intervals Graph1.GraphData = 5 Graph1.GraphData = 6 Graph1.GraphData = 7 Graph1.GraphData = 8 Graph1.ThisSet = 2 ' End of intervals Graph1.GraphData = 7 Graph1.GraphData = 8 Graph1.GraphData = 11 Graph1.GraphData = 15After assigning values to the graph, set the GraphType to 5 to indicate a Gantt chart, and set GraphStyle to 1 if you want spaced bars. Set DrawMode to 2 and DrawStyle to 1 if you want color.
Step-by-Step ExampleThis example creates the Gantt chart.
|
Additional reference words: 3.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |