GanttChart

Modified in version 5.0

GanttChart ( appearanceConst ;​ categoryGap ;​ barDepth )

Argument Type Range Default Note
appearanceConst int 0..127 default
categoryGap num 0..1000 100 In % of bar width
barDepth num 0..1000 0 In % of bar width
Examples
Description

The GanttChart() function serves to graphically organize time-dependent tasks, such as for project management. This type of chart was used for the first time in 1917 by Henry L. Gantt. Each task is defined by entering at least two values in ChartData() ; the first value defines the beginning of a task, the second value the end. By defining more than two values per series, a task can be divided into several partial tasks.

GANTT_CHART_01
1

OpenDrawing(250;​150)

2

ChartData( 4 33 68 80 85 100;​ /* Task 1 (3 part. tasks) */

3

33 68 80 94) /* Task 2 (2 part. tasks) */

4

GanttChart()

5

/* Set up styles. */

6

FillStyle(1;​#4682b4)

7

FillStyle(2;​red)

8

BorderStyle(all;​none)

9

/* Set up axes. */

10

AxisLine(all;​0)

11

AxisMajorTicks(all;​0)

12

/* Set up grid. */

13

MajorGridLineWidths(x;​y;​0)

14

MajorGridLineWidths(y;​x;​0.25)

15

CloseDrawing()

GANTT_CHART_01

The 1st argument appearanceConstants makes it possible to rotate the chart 90 degrees (appearanceConstants = horizontal) and add shadow (appearanceConstants = shadow) and labels (appearanceConstants = label) to the bars. All options can be combined by using a plus sign "+".

GANTT_CHART_02
1

OpenDrawing(250;​150)

2

ChartData( 0 24 38 62 76 100;​

3

10 58 70 94;​

4

20 100)

5

GanttChart(label+shadow+horizontal)

6

/* Set up styles. */

7

FillStyle(1;​#00afef;​shaded)

8

FillStyle(2;​#9cccf0;​shaded)

9

FillStyle(3;​#cbdb29;​shaded)

10

BorderStyle(all;​none)

11

ShadowStyle(all;​2 2 3)

12

/* Set up axes. */

13

AxisLine(all;​0)

14

AxisMajorTicks(all;​0)

15

/* Set up grid. */

16

MajorGridLineWidths(y;​x;​0)

17

MajorGridLineWidths(x;​y;​0.25)

18

CloseDrawing()

GANTT_CHART_02

The fills, borders and shadows can be varied by using the style functions FillColorScheme() , FillStyle() , PictureStyle() , BorderColorScheme() , BorderStyle() and ShadowStyle() and the labels by using the five style functions LabelTexts() , LabelTexts() , LabelBackground() , LabelBackgroundOptions() and LabelOptions() .

GANTT_CHART_03
1

OpenDrawing(250;​150)

2

ChartData( 0 24 38 62 74 90;​

3

38 100;​

4

10 58 70 100;​

5

0 50;​

6

0 100;​

7

12 52 90 100)

8

GanttChart()

9

/* Set up styles. */

10

FillColorScheme(3;​shaded)

11

BorderStyle(all;​none)

12

BarStyle(all;​1 50;​1 50)

13

/* Set up axes. */

14

ScalingOptions(y;​on) /* y-scale top to bottom. */

15

AxisLine(all;​0)

16

AxisMajorTicks(all;​0)

17

/* Set up grid. */

18

MajorGridLineWidths(x;​y;​0)

19

MajorGridLineWidths(y;​x;​0.25)

20

CloseDrawing()

GANTT_CHART_03
GANTT_CHART_04
1

OpenDrawing(250;​150)

2

ChartData( 0 24 38 62 76 100;​

3

10 58 70 94;​

4

20 100)

5

GanttChart(label+shadow)

6

/* Set up styles. */

7

FillStyle(1;​#005ca9)

8

FillStyle(2;​#00afef)

9

FillStyle(3;​#cbdb29)

10

BorderStyle(all;​none)

11

LabelStyle(1;​;​;​bold;​white)

12

LabelStyle(2;​;​;​bold;​white)

13

LabelTexts(2;​"Part 1 (|u|)";​"|u|")

14

LabelTexts(3;​"|u| days")

15

ShadowStyle(all;​2 2 3)

16

/* Set up axes. */

17

ScalingOptions(y;​on) /* y-scale top to bottom. */

18

AxisLine(all;​0)

19

AxisMajorTicks(all;​0)

20

AxisMajorTickLabelTexts(y;​"A";​"B";​"C")

21

/* Set up grid. */

22

MajorGridLineWidths(x;​y;​0)

23

MajorGridLineWidths(y;​x;​0.25)

24

CloseDrawing()

GANTT_CHART_04

By using the 2nd argument categoryGap, the space between the bars can be controlled. The argument categoryGap should be entered in percent of the bar width. As the default, the space between two bars is exactly one bar width, i.e. categoryGap =​ 100. For a categoryGap less than 100 the space is smaller and the bars wider; for a categoryGap greater than 100 the space is bigger and the bars narrower.

GANTT_CHART_05
1

OpenDrawing(250;​150)

2

ChartData(2022-07-14 2022-08-23 2022-09-24 2022-12-02;​

3

2022-07-14 2022-12-02;​

4

2022-08-20 2022-12-28)

5

GanttChart(shadow;​75)

6

/* Set up styles. */

7

FillStyle(1;​#005ca9)

8

FillStyle(2;​#00afef)

9

FillStyle(3;​#cbdb29)

10

BorderStyle(all;​none)

11

ShadowStyle(all;​2 2 3)

12

/* Set up axes. */

13

ScalingOptions(y;​on) /* y-scale top to bottom. */

14

AxisLine(all;​0)

15

AxisMajorTicks(all;​0)

16

AxisMajorTickLabelStyle(x;​Verdana;​9;​plain;​black;​;​-45)

17

AxisMajorTickLabelTexts(x;​"|Mon|")

18

AxisMajorTickLabelTexts(y;​"A";​"B";​"C")

19

/* Set up grid. */

20

MajorGridLineWidths(x;​y;​0)

21

MajorGridLineWidths(y;​x;​0.25)

22

CloseDrawing()

GANTT_CHART_05
GANTT_CHART_06
1

OpenDrawing(250;​150)

2

ChartData( 0 24 38 62 74 90;​

3

38 100;​

4

10 58 70 100;​

5

0 50;​

6

0 100;​

7

12 52 90 100)

8

GanttChart(shadow;​0)

9

/* Set up styles. */

10

FillColorScheme(7;​shaded)

11

BorderStyle(all;​none)

12

ShadowStyle(all;​2 2 3)

13

/* Set up axes. */

14

ScalingOptions(y;​on) /* y-scale top to bottom. */

15

AxisLine(all;​0)

16

AxisMajorTicks(all;​0)

17

/* Set up grid. */

18

MajorGridLineWidths(x;​y;​0)

19

MajorGridLineWidths(y;​x;​0.25)

20

CloseDrawing()

GANTT_CHART_06
GANTT_CHART_07
1

OpenDrawing(250;​150)

2

ChartData( 0 24 38 62 76 100;​

3

10 58 70 94;​

4

20 100)

5

GanttChart(label+shadow+horizontal;​250)

6

/* Set up styles. */

7

FillStyle(1;​#00afef;​shaded)

8

FillStyle(2;​#9cccf0;​shaded)

9

FillStyle(3;​#cbdb29;​shaded)

10

BorderStyle(all;​none)

11

ShadowStyle(all;​2 2 3)

12

/* Set up axes. */

13

ScalingOptions(y;​on) /* y-scale top to bottom. */

14

AxisLine(all;​0)

15

AxisMajorTicks(all;​0)

16

/* Set up grid. */

17

MajorGridLineWidths(y;​x;​0)

18

MajorGridLineWidths(x;​y;​0.25)

19

CloseDrawing()

GANTT_CHART_07

The 3rd argument barDepth can be used to control the three-dimensional drawing of bars. The bar depth is to be entered in percentage of the bar width.

GANTT_CHART_08
1

OpenDrawing(250;​150)

2

ChartData( 0 24 38 62 74 90;​

3

38 100;​

4

10 58 70 100;​

5

0 50;​

6

0 100;​

7

12 52 70 90)

8

GanttChart(shadow;​75;​30)

9

/* Set up styles. */

10

FillColorScheme(3;​shaded)

11

BorderStyle(all;​none)

12

ShadowStyle(all;​2 2 3)

13

/* Set up axes. */

14

ScalingOptions(y;​on) /* y-scale top to bottom. */

15

AxisLine(all;​0)

16

AxisMajorTicks(all;​0)

17

/* Set up grid. */

18

MajorGridLineWidths(all;​all;​0)

19

MajorGridLineWidths(x;​y;​0)

20

MajorGridLineWidths(y;​x;​0.25)

21

MajorGridLineWidths(z;​x;​0.25)

22

CloseDrawing()

GANTT_CHART_08
GANTT_CHART_09
1

OpenDrawing(250;​150)

2

ChartData( 0 24 38 62 76 100;​

3

10 58 70 94;​

4

20 100)

5

GanttChart(label+horizontal+shadow;​;​15)

6

/* Set up styles. */

7

FillStyle(1;​#005ca9)

8

FillStyle(2;​#00afef)

9

FillStyle(3;​#cbdb29)

10

BorderStyle(all;​none)

11

ShadowStyle(all;​2 2 5)

12

LabelStyle(1;​;​;​bold;​white)

13

/* Set up axes. */

14

ScalingOptions(y;​on) /* y-scale top to bottom. */

15

AxisLine(all;​0)

16

AxisMajorTicks(all;​0)

17

/* Set up grid. */

18

MajorGridLineWidths(all;​all;​0)

19

MajorGridLineWidths(y;​x;​0)

20

MajorGridLineWidths(x;​y;​0.25)

21

MajorGridLineWidths(z;​y;​0.25)

22

CloseDrawing()

GANTT_CHART_09


Starting with xmCHART 5 it is possible to assign an individual fill color to each partial task of a Gantt chart. For example:

FillStyle(2;​red;​solid;​ /* Partial task 1 of series 2, fill color: red.  */

green;​solid;​ /* Partial task 2 of series 2, fill color: green.  */

blue;​shaded) /* Partial task 3 of series 2, fill color: shaded blue. */

The additional color;colorVariant arguments in function FillStyle() are available only for Gantt charts and are ignored in combination with other chart types. All other style functions such as BorderStyle() , LabelStyle() , etc. have not been modified.

GANTT_CHART_10
1

OpenDrawing(250;​150)

2

ChartData( 0 24 38 62 76 100;​

3

10 58 70 94;​

4

20 100)

5

GanttChart(label+shadow)

6

/* Set up styles. */

7

FillStyle(1;​steelBlue;​0;​darkGreen;​0;​darkRed)

8

FillStyle(2;​deepSkyBlue;​0;​steelblue;​shaded)

9

FillStyle(3;​yellowGreen)

10

BorderStyle(all;​none)

11

LabelStyle(1;​;​;​bold;​white)

12

LabelStyle(2;​;​;​bold;​white)

13

LabelTexts(2;​"Part 1 (|u|)";​"|u|")

14

LabelTexts(3;​"|u| days")

15

ShadowStyle(all;​2 2 3)

16

/* Set up axes. */

17

ScalingOptions(y;​on) /* y-scale top to bottom. */

18

AxisLine(all;​0)

19

AxisMajorTicks(all;​0)

20

AxisMajorTickLabelTexts(y;​"A";​"B";​"C")

21

/* Set up grid. */

22

MajorGridLineWidths(x;​y;​0)

23

MajorGridLineWidths(y;​x;​0.25)

24

CloseDrawing()

GANTT_CHART_10
Scroll to Top