Top
You are looking at an outdated 7.5.1 version of this document. Switch to the 8.0.1 version to see the up to date information.

class anychart.charts.Gantt Improve this Doc

Extends: anychart.core.SeparateChart

Gantt chart class.

Methods Overview

Miscellaneous
collapseAll()Collapse all expanded tasks
collapseTask()Collapses task by id.
data()Getter for chart data.
dataGrid()Getter for data grid.
draw()Draws gantt chart.
expandAll()Expands all collapsed tasks.
expandTask()Expands task by id.
fitAll()Fits all visible data to width of timeline.
fitToTask()Fits the visible area of the timeline to the range of specified tasks.
getTimeline()Getter for timeline.
getType()Returns chart type.
headerHeight()Getter for header height.
rowHoverFill()Getter for row hover fill.
rowSelectedFill()Getter for row selected fill.
scrollTo()Performs vertical scrolling by pixel offset.
scrollToEnd()Scrolls vertically to specified index.
scrollToRow()Performs vertical scroll for row at the specified index.
zoomIn()Timeline zoom in.
zoomOut()Timeline zoom out.
zoomTo()Timeline zoom to range.

Methods Description

collapseAll

Collapse all expanded tasks
Method collapseAll should be used after drawing chart.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

collapseTask

Collapses task by id.
Method collapseTask should be used after drawing chart.

Params:

Name Type Description
taskId string Task id.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

data

Getter for chart data.

Returns:

anychart.data.Tree - Returns current data tree.

Try it:

Setter for chart data.

Params:

Name Type Description
data anychart.data.Tree | Array.<Object> Data tree or raw data.
fillMethod anychart.enums.TreeFillingMethod | string Fill method.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

dataGrid

Getter for data grid.

Returns:

anychart.core.ui.DataGrid - Chart's data grid.

Try it:

Setter for data grid.

Params:

Name Type Default Description
enabled boolean
true
Enabled or disabled data grid.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

Gets data grid or enables/disables it. NOTE: In current implementation (25 Feb 2015) data grid is not configurable by JSON, can't be set directly and can't be null.

Params:

Name Type Description
enabled boolean If data grid must be enabled/disabled.

Returns:

anychart.core.ui.DataGrid anychart.charts.Gantt - - Data grid or chart itself for method chaining.

draw

Draws gantt chart.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

expandAll

Expands all collapsed tasks.
Method expandAll should be used after drawing chart.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

expandTask

Expands task by id.
Method expandTask should be used after drawing chart.

Params:

Name Type Description
taskId string Task id.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

fitAll

Fits all visible data to width of timeline.
Method fitAll should be used after drawing chart.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

fitToTask

Fits the visible area of the timeline to the range of specified tasks.

Params:

Name Type Description
taskId string Task id.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

getTimeline

Getter for timeline.

Returns:

anychart.core.gantt.Timeline - Chart's timeline.

Try it:

getType

Returns chart type.

Returns:

anychart.enums.ChartTypes - Current chart type.

Try it:

headerHeight

Getter for header height.

Returns:

number string - Current value header height.

Try it:

Setter for header height.

Params:

Name Type Default Description
value number | string
70
Value to set.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

rowHoverFill

Getter for row hover fill.

Returns:

anychart.graphics.vector.Fill string - Current value hover fill.

Try it:

Sets row hover fill settings using an object or a string. Learn more about coloring.

Params:

Name Type Default Description
value anychart.graphics.vector.Fill
'#edf8ff'
Color as an object or a string.

Returns:

anychart.charts.Gantt - Self instance for method chaining.
Fill color with opacity.
Fill as a string or an object.

Params:

Name Type Description
color string Color as a string.
opacity number Color opacity.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

Linear gradient fill. Learn more about coloring.

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Gradient keys.
angle number Gradient angle.
mode boolean | anychart.graphics.vector.Rect | Object Gradient mode.
opacity number Gradient opacity.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

Radial gradient fill. Learn more about coloring.

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Color-stop gradient keys.
cx number X ratio of center radial gradient.
cy number Y ratio of center radial gradient.
mode anychart.graphics.math.Rect If defined then userSpaceOnUse mode, else objectBoundingBox.
opacity number Opacity of the gradient.
fx number X ratio of focal point.
fy number Y ratio of focal point.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

rowSelectedFill

Getter for row selected fill.

Returns:

anychart.graphics.vector.Fill string - Current value row selected fill.

Try it:

Sets row selected fill settings using an object or a string. Learn more about coloring.

Params:

Name Type Default Description
value anychart.graphics.vector.Fill
'#d2eafa'
Color as an object or a string.

Returns:

anychart.charts.Gantt - Self instance for method chaining.
Fill color with opacity.
Fill as a string or an object.

Params:

Name Type Description
color string Color as a string.
opacity number Color opacity.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

Linear gradient fill. Learn more about coloring.

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Gradient keys.
angle number Gradient angle.
mode boolean | anychart.graphics.vector.Rect | Object Gradient mode.
opacity number Gradient opacity.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

Radial gradient fill. Learn more about coloring.

Params:

Name Type Description
keys Array.<(anychart.graphics.vector.GradientKey|string)> Color-stop gradient keys.
cx number X ratio of center radial gradient.
cy number Y ratio of center radial gradient.
mode anychart.graphics.math.Rect If defined then userSpaceOnUse mode, else objectBoundingBox.
opacity number Opacity of the gradient.
fx number X ratio of focal point.
fy number Y ratio of focal point.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

scrollTo

Performs vertical scrolling by pixel offset.
Method scrollTo should be used after drawing chart.

Params:

Name Type Description
pxOffset number Value for pixel offset to set.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

scrollToEnd

Scrolls vertically to specified index.
Method scrollToEnd should be used after drawing chart.

Params:

Name Type Description
index number End index to scroll to set.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

scrollToRow

Performs vertical scroll for row at the specified index.

Params:

Name Type Description
rowIndex number Row index.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

zoomIn

Timeline zoom in.
Method zoomIn works after calculation scale. Therefore, it should be used after method draw.

Params:

Name Type Description
zoomFactor number Zoom factor.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

zoomOut

Timeline zoom out.
Method zoomOut works after calculation scale. Therefore, it should be used after method draw.

Params:

Name Type Description
zoomFactor number Zoom factor.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it:

zoomTo

Timeline zoom to range.

Params:

Name Type Description
startDate number Start date.
endDate number End date.

Returns:

anychart.charts.Gantt - Self instance for method chaining.

Try it: