Gantt chart API reference

Documentation about the Gantt chart including information about all of the options that are available to you. The Gantt chart is commonly used to show scheduling information regarding timetables for people or events. There's a demo that shows an interactive Gantt chart.

Example

<script>
    new RGraph.Gantt({
        id: 'cvs',
        data: [
            {start: 31,  duration: 28, complete: null, label: 'Richard', background: null, color: null, border: 'rgba(0,0,0,0)'],
            {start: 31,  duration: 28, complete: null, label: 'Fred',    background: null, color: null, border: 'rgba(0,0,0,0)'],
            {start: 59,  duration: 14, complete: null, label: 'Barney',  background: null, color: null, border: 'rgba(0,0,0,0)'],
            {start: 59,  duration: 21, complete: null, label: 'Gloria',  background: null, color: null, border: 'rgba(0,0,0,0)'],
            {start: 59,  duration: 31, complete: null, label: 'Paul',    background: null, color: null, border: 'rgba(0,0,0,0)'],
            {start: 80,  duration: 21, complete: null, label: 'Harry',   background: null, color: null  border: 'rgba(0,0,0,0)'],
            {start: 94,  duration: 7,  complete: null, label: 'Shane',   background: null, color: null, border: 'rgba(0,0,0,0)'],
            {start: 120, duration: 14, complete: null, label: 'Barry',   background: null, color: null, border: 'rgba(0,0,0,0)'],
            {start: 130, duration: 14, complete: null, label: 'Cynthia', background: null, color: null, border: 'rgba(0,0,0,0)'],
            {start: 211, duration: 61, complete: null, label: 'Graham',  background: null, color: null, border: 'rgba(0,0,0,0)'],
            {start: 334, duration: 31, complete: null, label: 'Paul',    background: null, color: null, border: 'rgba(0,0,0,0)']
        ],
        options: {
            xaxisScaleMax: 365,
            marginLeft: 75,
            xaxisLabels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
            title: 'Holiday schedule for Xyz Ltd',
            colorsDefault: 'rgba(255,0,0,1)',
            tooltips: [
                "<b>Richard</b><br />Richard is going on holiday.<br />He'll be away for 28 days.",
                "<b>Fred</b><br />Fred is also going away for 28 days",
                "<b>Barney</b><br />Barney is off work for two weeks",
                "<b>Gloria</b><br />Gloria is off work for 3 weeks",
                "<b>Paul</b><br /> Away for 31 days",
                "<b>Harry</b><br />Away for three weeks",
                "<b>Shane</b><br />Away for one week",
                "<b>Barry</b><br />Away for two weeks",
                "<b>Cynthia</b><br />Away for two weeks",
                "<b>Graham</b><br />Away for August and September",
                "<b>Paul</b><br />Away for 31 days"
            ],
            backgroundVbars: [
                [0, 31, 'rgba(192,255,192,0.5)'],
                [59, 31, 'rgba(192,255,192,0.5)'],
                [120, 31, 'rgba(192,255,192,0.5)'],
                [181, 31, 'rgba(192,255,192,0.5)'],
                [243, 30, 'rgba(192,255,192,0.5)'],
                [304, 30, 'rgba(192,255,192,0.5)']
            ]
        }
    }).draw();
</script>

Properties

You can use these properties to control how the chart appears. You can set them by including them in the options section of the configuration as above.

Background properties

PropertyDescriptionDefault
backgroundBarsCountThe number of background bars.5
backgroundBarsColor1Color of the background bars.white
backgroundBarsColor2Color of the background bars.white
backgroundGridWhether a grid is shown as part of the background.true
backgroundGridColorThe color of the background grid.#eee
backgroundGridLinewidthThe linewidth of the background grid.1
backgroundGridVlinesCountWhen using autofit this allows you to specify how many vertical grid lines you want.20
backgroundGridDottedIf you want to have your background grid dashed then set this to true.false
backgroundGridDashedIf you want to have your background grid dotted then set this to true. This takes precedence over dashed lines.false
backgroundVbarsVertical bars used for decorative purposes, or for marking something on the chart (an event for example). See below for further information.[] (An empty array)
backgroundHbarsHorizontal bars used for decorative purposes, or for marking something on the chart (an event for example). See below for further information.[] (An empty array)
backgroundColorIf you want to have a single background color for your chart you can use this. It doesn't cover the margins. If you want that then you can simply apply a CSS background color to the canvas tag.null
backgroundBarsCount
The number of background bars.
Default: 5

backgroundBarsColor1
Color of the background bars.
Default: white

backgroundBarsColor2
Color of the background bars.
Default: white

backgroundGrid
Whether a grid is shown as part of the background.
Default: true

backgroundGridColor
The color of the background grid.
Default: #eee

backgroundGridLinewidth
The linewidth of the background grid.
Default: 1

backgroundGridVlinesCount
When using autofit this allows you to specify how many vertical grid lines you want.
Default: 20

backgroundGridDotted
If you want to have your background grid dashed then set this to true.
Default: false

backgroundGridDashed
If you want to have your background grid dotted then set this to true. This takes precedence over dashed lines.
Default: false

backgroundVbars
Vertical bars used for decorative purposes, or for marking something on the chart (an event for example). See below for further information.
Default: [] (An empty array)

backgroundHbars
Horizontal bars used for decorative purposes, or for marking something on the chart (an event for example). See below for further information.
Default: [] (An empty array)

backgroundColor
If you want to have a single background color for your chart you can use this. It doesn't cover the margins. If you want that then you can simply apply a CSS background color to the canvas tag.
Default: null

X axis properties

PropertyDescriptionDefault
xaxisScaleMaxRequired. This determines how many "units" wide the Gantt chart is. For example to represent a year, you would use 365, giving a granularity of one day.none
xaxisScaleMinThis option can sometimes make using a Gantt chart spread over several pages easier.0
xaxisLabelsWith the Gantt chart the labels are given as part of the data array. See the example code above.Not applicable
xaxisLabelsFontThe font used to render the text.null
xaxisLabelsSizeThe size of the text.null
xaxisLabelsColorThe color of the X axis labels.null
xaxisLabelsBoldWhether the X axis labels are bold or not.null
xaxisLabelsItalicWhether the X axis labels are italic or not.null
xaxisLabelsAlignThis determines whether the horizontal labels are drawn at the top (underneath the title) or at the bottom (in the bottom margin).bottom
xaxisTitleThe title used for the X axis title.null
xaxisTitleXBy giving this you can specifically set the X position of the X axis title.null
xaxisTitleYBy giving this you can specifically set the Y position of the X axis title.null
xaxisTitleFontThe font used to render the X axis title.null
xaxisTitleSizeThe size of the X axis title.null
xaxisTitleColorThis controls the color of the X axis title.null
xaxisTitleBoldWhether the X axis title is bold or not.null
xaxisTitleItalicWhether the X axis title is italic or not.null
xaxisScaleMax
Required. This determines how many "units" wide the Gantt chart is. For example to represent a year, you would use 365, giving a granularity of one day.
Default: none

xaxisScaleMin
This option can sometimes make using a Gantt chart spread over several pages easier.
Default: 0

xaxisLabels
With the Gantt chart the labels are given as part of the data array. See the example code above.
Default: Not applicable

xaxisLabelsFont
The font used to render the text.
Default: null

xaxisLabelsSize
The size of the text.
Default: null

xaxisLabelsColor
The color of the X axis labels.
Default: null

xaxisLabelsBold
Whether the X axis labels are bold or not.
Default: null

xaxisLabelsItalic
Whether the X axis labels are italic or not.
Default: null

xaxisLabelsAlign
This determines whether the horizontal labels are drawn at the top (underneath the title) or at the bottom (in the bottom margin).
Default: bottom

xaxisTitle
The title used for the X axis title.
Default: null

xaxisTitleX
By giving this you can specifically set the X position of the X axis title.
Default: null

xaxisTitleY
By giving this you can specifically set the Y position of the X axis title.
Default: null

xaxisTitleFont
The font used to render the X axis title.
Default: null

xaxisTitleSize
The size of the X axis title.
Default: null

xaxisTitleColor
This controls the color of the X axis title.
Default: null

xaxisTitleBold
Whether the X axis title is bold or not.
Default: null

xaxisTitleItalic
Whether the X axis title is italic or not.
Default: null

Y axis properties

PropertyDescriptionDefault
yaxisTitleThe title of the Gantt chart.null
yaxisTitleFontThe font that the Y axis title is rendered in.null
yaxisTitleSizeThe size of the Y axis title.null
yaxisTitleColorThe color of the Y axis title.null
yaxisTitleBoldWhether the Y axis title is bold or not.null
yaxisTitleItalicWhether the Y axis title is italic or not.null
yaxisTitleXBy giving this you can specifically set the X position of the Y axis title.null
yaxisTitleYBy giving this you can specifically set the Y position of the Y axis title.null
yaxisLabelsFontThe font used to render the Y axis labels.null
yaxisLabelsSizeThe size of the Y axis labels.null
yaxisLabelsColorThe color of the Y axis labels.null
yaxisLabelsBoldWhether the Y axis labels are bold or not.null
yaxisLabelsItalicWhether the Y axis labels are italic or not.null
yaxisTitle
The title of the Gantt chart.
Default: null

yaxisTitleFont
The font that the Y axis title is rendered in.
Default: null

yaxisTitleSize
The size of the Y axis title.
Default: null

yaxisTitleColor
The color of the Y axis title.
Default: null

yaxisTitleBold
Whether the Y axis title is bold or not.
Default: null

yaxisTitleItalic
Whether the Y axis title is italic or not.
Default: null

yaxisTitleX
By giving this you can specifically set the X position of the Y axis title.
Default: null

yaxisTitleY
By giving this you can specifically set the Y position of the Y axis title.
Default: null

yaxisLabelsFont
The font used to render the Y axis labels.
Default: null

yaxisLabelsSize
The size of the Y axis labels.
Default: null

yaxisLabelsColor
The color of the Y axis labels.
Default: null

yaxisLabelsBold
Whether the Y axis labels are bold or not.
Default: null

yaxisLabelsItalic
Whether the Y axis labels are italic or not.
Default: null

Color properties

PropertyDescriptionDefault
colorsDefaultThe default color of bars. If you don't specify a color for the event, this will be used.white
colorsDefault
The default color of bars. If you don't specify a color for the event, this will be used.
Default: white

Margin properties

PropertyDescriptionDefault
marginLeftThe left margin of the chart, (the margin is where the labels and title are)).25
marginRightThe right margin of the chart, (the margin is where the labels and title are).25
marginTopThe top margin of the chart, (the margin is where the labels and title are).25
marginBottomThe bottom margin of the chart, (the margin is where the labels and title are).25
marginInnerActs much like the marginInner setting for the bar chart. By using this setting you can give yourself thin bars.2
marginLeft
The left margin of the chart, (the margin is where the labels and title are)).
Default: 25

marginRight
The right margin of the chart, (the margin is where the labels and title are).
Default: 25

marginTop
The top margin of the chart, (the margin is where the labels and title are).
Default: 25

marginBottom
The bottom margin of the chart, (the margin is where the labels and title are).
Default: 25

marginInner
Acts much like the marginInner setting for the bar chart. By using this setting you can give yourself thin bars.
Default: 2

Labels and text properties

PropertyDescriptionDefault
textAccessibleA new feature in 2016 that allows you to use DOM text in place of canvas text. It makes for much higher quality text that you can also select if desired (for copy/paste operations). It won't fit all situations and you can read more about the DOM text feature here. A good way to control borders/margins/padding etc is not to set them on the canvas but to wrap the canvas in a div and set them on that like this:
<div style="margin-left: 50px; display: inline-block">
<canvas id="cvs" width="650" height="250"></canvas>
</div>
true
textAccessibleOverflowThis can be visible or hidden and it controls whether the text is clipped to the edges of the canvas. It defaults to be visible and means you can set small margins if you wish.visible
textAccessiblePointereventsThis controls whether the DOM text responds to mouse based events or not (it sets the pointer-events CSS property to none).false
textSizeThe size of the text (in points).12
textFontThe font used to render the text.Arial, Verdana, sans-serif
textColorThe color of the labels.black
textBoldWhether the text on the chart is bold or not.false
textItalicWhether the text on the chart is italic or not.false
labelsInbarAn array of labels that are drawn inside the Gantt chart bars. These labels can also be drawn on the right of these bars.null
labelsInbarAlignThis controls whether the labels are aligned left, center or right when the labels are drawn inside the bars.left
labelsInbarBgcolorThe background color for the text. By default there's no background to the text.null
labelsInbarColorThe color of the labels.null
labelsInbarFontThe font used to draw the labels.null
labelsInbarSizeThe size of the text labels.null
labelsInbarBoldWhether the inbar labels are bold or not.null
labelsInbarItalicWhether the inbar labels are italic or not.null
labelsInbarAboveIf you prefer, the labels can be drawn "above" the bars (actually to the right but for API compatibility it's called "above").false
labelsCompleteThis allows you to turn off the "percent complete" indicator if you want to.true
labelsCompleteFontThe font used to render the percent-complete number.null
labelsCompleteSizeThe size of the text.null
labelsCompleteColorThe color of the text.null
labelsCompleteBoldWhether the text is bold or not.null
labelsCompleteItalicWhether the text is italic or not.null
textAccessible
A new feature in 2016 that allows you to use DOM text in place of canvas text. It makes for much higher quality text that you can also select if desired (for copy/paste operations). It won't fit all situations and you can read more about the DOM text feature here. A good way to control borders/margins/padding etc is not to set them on the canvas but to wrap the canvas in a div and set them on that like this:
<div style="margin-left: 50px; display: inline-block">
<canvas id="cvs" width="650" height="250"></canvas>
</div>

Default: true

textAccessibleOverflow
This can be visible or hidden and it controls whether the text is clipped to the edges of the canvas. It defaults to be visible and means you can set small margins if you wish.
Default: visible

textAccessiblePointerevents
This controls whether the DOM text responds to mouse based events or not (it sets the pointer-events CSS property to none).
Default: false

textSize
The size of the text (in points).
Default: 12

textFont
The font used to render the text.
Default: Arial, Verdana, sans-serif

textColor
The color of the labels.
Default: black

textBold
Whether the text on the chart is bold or not.
Default: false

textItalic
Whether the text on the chart is italic or not.
Default: false

labelsInbar
An array of labels that are drawn inside the Gantt chart bars. These labels can also be drawn on the right of these bars.
Default: null

labelsInbarAlign
This controls whether the labels are aligned left, center or right when the labels are drawn inside the bars.
Default: left

labelsInbarBgcolor
The background color for the text. By default there's no background to the text.
Default: null

labelsInbarColor
The color of the labels.
Default: null

labelsInbarFont
The font used to draw the labels.
Default: null

labelsInbarSize
The size of the text labels.
Default: null

labelsInbarBold
Whether the inbar labels are bold or not.
Default: null

labelsInbarItalic
Whether the inbar labels are italic or not.
Default: null

labelsInbarAbove
If you prefer, the labels can be drawn "above" the bars (actually to the right but for API compatibility it's called "above").
Default: false

labelsComplete
This allows you to turn off the "percent complete" indicator if you want to.
Default: true

labelsCompleteFont
The font used to render the percent-complete number.
Default: null

labelsCompleteSize
The size of the text.
Default: null

labelsCompleteColor
The color of the text.
Default: null

labelsCompleteBold
Whether the text is bold or not.
Default: null

labelsCompleteItalic
Whether the text is italic or not.
Default: null

Title properties

PropertyDescriptionDefault
titleThe title of the chart.not set
titleFontThe font that the title is rendered in. If not specified the textFont setting is used (usually Arial).null
titleSizeThe size of the title. If not specified the size is usually 2pt bigger than the textSize setting.null
titleBoldWhether the title is bold or not.true
titleItalicWhether the title is italic or not.false
titleColorThe color of the title.black
titleBackgroundThe background color (if any) for the title.null
titleXTo give the exact X coordinate for the title - use this. This can also be a string like this: "-5" -- in which case it's converted to a number and added to the calculated coordinate - allowing you to adjust the calculated coordinate.null
titleYTo give the exact Y coordinate for the title - use this. This can also be a string like this: "-5" -- in which case it's converted to a number and added to the calculated coordinate - allowing you to adjust the calculated coordinate.null
title
The title of the chart.
Default: not set

titleFont
The font that the title is rendered in. If not specified the textFont setting is used (usually Arial).
Default: null

titleSize
The size of the title. If not specified the size is usually 2pt bigger than the textSize setting.
Default: null

titleBold
Whether the title is bold or not.
Default: true

titleItalic
Whether the title is italic or not.
Default: false

titleColor
The color of the title.
Default: black

titleBackground
The background color (if any) for the title.
Default: null

titleX
To give the exact X coordinate for the title - use this. This can also be a string like this: "-5" -- in which case it's converted to a number and added to the calculated coordinate - allowing you to adjust the calculated coordinate.
Default: null

titleY
To give the exact Y coordinate for the title - use this. This can also be a string like this: "-5" -- in which case it's converted to a number and added to the calculated coordinate - allowing you to adjust the calculated coordinate.
Default: null

Interactive features properties

PropertyDescriptionDefault
tooltipsAn array of tooltips that are shown when the bars are clicked. They can contain HTML.(An empty array)
tooltipsEventThis is the event that triggers the tooltips. It can be either click or mousemove.onclick
tooltipsEffectThe effect used for showing tooltips. Can be either fade or none.fade
tooltipsCssClassThis is the name of the CSS class the chart uses.RGraph_tooltip
tooltipsOverrideIf you wish to handle showing tooltips yourself, this should be a function object which does just that. There's more information on the tooltips documentation page.null
tooltipsNohideonclearNot an option that you'll need particularly often if at all. Setting this to true means that when you call the RGraph.clear() API function tooltips DO NOT get hidden.false
contextmenuAn array of context menu items. Cannot be used in conjunction with tooltips.(An empty array)
annotatableWhether annotations are enabled for the chart (ie you can draw on the chart interactively.false
annotatableColorIf you do not allow the use of the palette, then this will be the only color allowed for annotations.black
annotatableLinewidthThis is the linewidth of the annotations.1
adjustableDefaulting to false, this determines whether your bar chart will be adjustable.false
adjustableOnlyThis should be an array of values that determine whether a Bar is adjustable or not. A truthy value for when it is, a falsey value for when it's not.null
tooltips
An array of tooltips that are shown when the bars are clicked. They can contain HTML.
Default: (An empty array)

tooltipsEvent
This is the event that triggers the tooltips. It can be either click or mousemove.
Default: onclick

tooltipsEffect
The effect used for showing tooltips. Can be either fade or none.
Default: fade

tooltipsCssClass
This is the name of the CSS class the chart uses.
Default: RGraph_tooltip

tooltipsOverride
If you wish to handle showing tooltips yourself, this should be a function object which does just that. There's more information on the tooltips documentation page.
Default: null

tooltipsNohideonclear
Not an option that you'll need particularly often if at all. Setting this to true means that when you call the RGraph.clear() API function tooltips DO NOT get hidden.
Default: false

contextmenu
An array of context menu items. Cannot be used in conjunction with tooltips.
Default: (An empty array)

annotatable
Whether annotations are enabled for the chart (ie you can draw on the chart interactively.
Default: false

annotatableColor
If you do not allow the use of the palette, then this will be the only color allowed for annotations.
Default: black

annotatableLinewidth
This is the linewidth of the annotations.
Default: 1

adjustable
Defaulting to false, this determines whether your bar chart will be adjustable.
Default: false

adjustableOnly
This should be an array of values that determine whether a Bar is adjustable or not. A truthy value for when it is, a falsey value for when it's not.
Default: null

Event properties

PropertyDescriptionDefault
eventsClickIf you want to add your own click function you can do so by assigning it to this property. See here for details.null
eventsMousemoveIf you want to add your own mousemove function you can do so by assigning it to this property. See here for details.null
eventsMouseoverIf you want to add your own mouseover function you can do so by assigning it to this property. See here for details.null
eventsMouseoutIf you want to add your own mouseout function you can do so by assigning it to this property. See here for details.null
eventsClick
If you want to add your own click function you can do so by assigning it to this property. See here for details.
Default: null

eventsMousemove
If you want to add your own mousemove function you can do so by assigning it to this property. See here for details.
Default: null

eventsMouseover
If you want to add your own mouseover function you can do so by assigning it to this property. See here for details.
Default: null

eventsMouseout
If you want to add your own mouseout function you can do so by assigning it to this property. See here for details.
Default: null

Miscellaneous properties

PropertyDescriptionDefault
highlightStyleBy default this is null but you can set it to a function if you wish so that function is called to do the chart highlighting. It's passed the shape object as an argument.null
highlightStrokeIf you use tooltips, this controls the color of the highlight stroke.black
highlightFillIf you use tooltips, this controls the color of the highlight fill.rgba(255,255,255,0.5)
bordersWhether a border is shown on the event bars.true
cleartoThis is used in animations and effects as the default color to use when the canvas is cleared.null
highlightStyle
By default this is null but you can set it to a function if you wish so that function is called to do the chart highlighting. It's passed the shape object as an argument.
Default: null

highlightStroke
If you use tooltips, this controls the color of the highlight stroke.
Default: black

highlightFill
If you use tooltips, this controls the color of the highlight fill.
Default: rgba(255,255,255,0.5)

borders
Whether a border is shown on the event bars.
Default: true

clearto
This is used in animations and effects as the default color to use when the canvas is cleared.
Default: null



Methods

obj.get(name)

An accessor function that you can use to retrieve the values of properties.

obj.set(name, value)

An accessor that you can use to set the values of properties.

obj.getShape(event)

This method returns the details of a focused bar (ie clicked or hovered over). It returns:

The shape also includes textual indexes like this: shape['object'] And they are:

obj.getXCoord(value)

This method can be used to get an appropriate X coordinate for a value when you're doing custom drawing on the chart. It returns null if the value is out of range.

obj.getValue(mixed)

This method can be used to get the value when the chart has been clicked on. The argument is the event object. You can also use this method outside of an event listener by giving the function an array as the argument containing the X/Y coordinates.

obj.canvas.onclick = function (e)
{
    var obj   = e.target.__object__;
    var value = obj.getValue(e);
    
    // ...
}
obj.on(event, function)

This method can be used to set an event listener on an object. It operates in a similar way to the jQuery on() function. The first argument is the event that you wish to attach to and the second is the handler function. For example:

.on('draw', function (obj)
{
    // Put event code here
});
The exec option and method

The exec function is documented here.

Adding events (the information represented on the chart) to your Gantt chart

To add events (the information represented on the chart), you now specify them as an argument to the constructor - it's no longer the events property.

myGantt = new RGraph.Gantt({
        id: 'cvs',
        data: [
            {start: 31, duration: 28, complete: 75, label: 'Richard'},
            {start: 12, duration: 28, complete: 67, label: 'Fred'},
            {start: 59, duration: 14, complete: 0,  label: 'Barney'},
            {start: 59, duration: 21, complete: 5,  label: 'Gloria'},
            {start: 46, duration: 31, complete: 94, label: 'Paul'}]
            {start: 80, duration: 21, complete: 46, label: 'Harry'},
            {start: 94, duration: 17, complete: 84, label: 'Shane'},
            {start: 34, duration: 14, complete: 32, label: 'Barry'},
            {start: 64, duration: 14, complete: 28, label: 'Cynthia', background: 'red', color: 'yellow'},
            {start: 13, duration: 61, complete: 74, label: 'Graham'},
            {start: 84, duration: 31, complete: 16, label: 'Paul'}
        ],
        options: {
        }
    );

The start value is the (zero indexed) start number relative to your xaxisScaleMax value. So if you have set your xaxisScaleMax to 62, (to represent two months), and this value is 31, the start will be the start of the second month. In this case you could give two labels - ['July', 'August'].

The duration value is the duration. So using the previous example, if you set this to 7, you would have an event lasting a week.

The complete value is the "percentage complete" indicator. This is shown to the right of the event and is optional - you can specify null if you wish.

The label value is the label that is used on the left hand side.

The optional background value stipulates the background color that the bar is. The default is white.

The optional color value is the foreground color of the bar. This defaults to #0c0.

The optional border value is the border color, defaulting to black

And the optional linewidth value is the numerical linewidth of the border. The default for this is 1.

Adding vertical and horizontal bars to your Gantt chart

You can add decorative vertical or horizontal bars like so:

...
vbars: [
    [0,   31, 'rgba(192,255,192,0.5)'],
    [59,  31, 'rgba(192,255,192,0.5)'],
    [120, 31, 'rgba(192,255,192,0.5)'],
    [181, 31, 'rgba(192,255,192,0.5)'],
    [243, 30, 'rgba(192,255,192,0.5)'],
    [304, 30, 'rgba(192,255,192,0.5)'],
],
hbars: [,'red',,,,'green'],
...

You can use these for decorative purposes, or to mark events/limits. For the vertical bars the first value is the start index, the same as above. The second value is the unit length, again, the same as above. The third value is the color of the vertical bar.

And for the horizontal bars you can specify the color of the bar - they automatically extend across the entire Gantt chart area. If you don't specify a color (as is demonstrated above) then there won't be a bar for that entry.

Animation effects

These effects are available and can be used instead of the draw() function. There are also generic effects available which you can see here: Generic effects and transitions
<script>
    /**
    * Optional callback function that's called when the effect is complete
    */
    function myCallback (obj)
    {
        // ...
    }

    var obj = new RGraph.Gantt({
        id: 'cvs',
        data: [
            {start: 0,  duration: 30},
            {start: 30, duration: 60},
            {start: 60, duration: 90}
        ],
        options: {
            marginLeft: 35,
            xaxisScaleMax: 90
        }
    }).grow({frames: 60}, myCallback)
</script>