Adding Scroll to Chart

The Gantt chart supports scrolling for both, the data table and the Gantt view pane.

In this section, you will be shown how you can:

  • Enable vertical scrolling

  • Enable scroll for the data table

  • Enable scroll for the Gantt pane

  • Configure scroll properties

  • Scroll to a particular date

Enabling Vertical Scrolling

Vertical scrolling is enabled by default depending on the height of the chart. If the number of processes fit within the height of the chart, vertical scrolling will not appear. You can also manually enable or disable vertical scrolling.

A Gantt chart with vertical scrolling disabled looks like this:

FusionCharts should load here..

Given below is a brief description of the attribute used to enable/disable vertical scrolling:

Attribute Name Description
useVerticalScrolling It is used to specify whether a vertical scroll bar will be enabled for the chart. Setting this attribute to 0 will disable the vertical scroll bar, setting it to 1(default) will enable. By default, the vertical scroll bar appears depending on the height of the chart.

The data structure needed to disable vertical scrolling is given below:

...

Enabling Scroll for the Data Table

The data table automatically starts to scroll when you add data columns that do not fit in the specified area of the grid.

A Gantt chart with a scroll rendered for the data table looks like this:

FusionCharts should load here..

The data structure needed to render the above chart is given below:

...

As you can see above, the scroll bar for data-grid automatically becomes active when the data in grid cannot fit itself in one screen.

To disable the scrollbar for data-grid, you have three options:

  • Increase the chart width so that the data-grid fits completely in one screen.

  • Set the ganttWidthPercent attribute to a lower value (0-100) for the global chart object. This attribute indicates the percent space (width) the Gantt pane takes. If the Gantt takes lesser space, the grid will get more space and will fit in the full labels.

  • Set the showFullDataTable attribute to '0' (false) for the chart object. This asks the chart to wrap and truncate the data labels and try to squeeze them in the required space (only if possible).

Enabling Scrolling for the Gantt Pane

By default, the Gantt pane never automatically scrolls, unless you explicitly specify it. To enable scrolling for the Gantt pane, you'll first need to decide the following - "What time frame should be visible in one screen of the Gantt pane?" Once this is decided and specified for the chart, the rest of time frame is shown upon scrolling. For example, you may decide that instead of showing the complete data, you want to see the data for only three months at one time.

A Gantt chart rendered to enable scrolling for the Gantt pane looks like this:

FusionCharts should load here..

Given below is a brief description of the attributes used to enable scrolling for the Gantt pane:

Attribute Name Description
ganttPaneDuration It is used to specify the timeline a Gantt pane will represent at a given point, if you want to enable the scroll. For example, if you want your Gantt pane to show the data for only three months in one screen and then scroll the rest, set the value of this attribute to 3.
ganttPaneDurationUnit It is used to specify the unit of your chosen duration, if you have opted to scroll through the Gantt pane.The possible values for this attribute are y,m,d, h, mn, and s.

The data structure needed to enable scrolling for the Gantt pane is given below:

...

Given below is a brief description of the values that the ganttPaneDurationUnit attribute can take:

Value What it represents?
y No. of years to display
m No. of months to display
d No. of days to display
h No. of hours to display
mn No. of minutes to display
s No. of seconds to display

If the duration specified by you is more than the actual time span of the chart, the scroll bar for the Gantt pane is not displayed.

Configuring Scroll Properties

You can configure several cosmetic properties for the scroll bar.

A Gantt chart with the scroll cosmetic properties configured looks like this:

FusionCharts should load here..

Given below is a brief description of the attributes used to configure scroll cosmetics:

Attribute Name Description
scrollColor It is used to specify the hex code of the color for the scroll bar, e.g. #CC0000.
scrollPadding It is used to specify the vertical padding between the scroll bar and the chart canvas.
scrollHeight It is used to specify the height of the scroll bar.
scrollBtnWidth It is used to specify the width of the scroll buttons.
scrollBtnPadding It is used to specify the horizontal padding between the scroll bar and the scroll buttons.
flatScrollBars It is used to specify whether scroll bars will be rendered as flat scroll bars. Setting this attribute to 0 will render the scroll bars with a gradient effect, setting it 1 (default) will render them as flat scroll bars.

All our previous charts are with flat scrollbars.

If you do not find this attribute in the data do not be surprised, as this attribute is set in the theme, we are using for the fiddles.

The data structure needed to configure the scroll bar cosmetics is given below:

...

Scroll to a Specific Date

For the Gantt chart, you can specify the date from where the chart will initially render.

The Social Media Optimization Gantt chart, that starts from Aug’14, configured to start rendering from Sept’14 looks like this:

FusionCharts should load here..

Given below is a brief description of the attribute used to set the date from which the chart will initially render:

Attribute Name Description
scrollToDate It is used to specify the date to which the chart will automatically scroll at the time of rendering. This attribute works only when the ganttPaneDuration and the ganttPaneDurationUnit attributes are set as per the requirement.

The data structure needed to set the date from which the chart will initially render is given below:

...

There! You have now seen how you can add and customize the scroll bars in a Gantt chart.