Skip to main content
Configure the Gantt Config Script in Widget Parameters > Advanced > Gantt Config Script.

Execution Context

The Gantt Config Script runs once during chart initialization on the client side. It has access to the gantt object and its configuration properties. diagram
The Gantt Config Script executes before the chart renders data. Modifications to gantt.config and gantt.templates take effect on the initial render. To apply changes after initialization, call gantt.render().

Configuration Properties (gantt.config)

Control Gantt behavior by setting gantt.config.* properties:

Interaction Properties

PropertyTypeDefaultDescription
gantt.config.drag_linksBooleantrueEnable or disable creating dependency links by dragging between task bars. Set to false to prevent users from creating links.
gantt.config.drag_progressBooleantrueEnable or disable dragging the progress indicator on task bars. Set to false when progress is calculated automatically.
gantt.config.show_progress_colorsBooleantrueEnable dynamic progress-based coloring (red, orange, blue, gray). Set to false for fully static coloring via task.color.

Display Properties

PropertyTypeDefaultDescription
gantt.config.workingHoursPerDayInteger8Default working hours per day for all resources. Overrides the server-side administration property for this widget instance.

Custom Working Hours Function

Define per-resource working hours:
gantt.config.workingHoursPerDayFunction = (resource) => {
    if (resource === "rProject") {
        return 4;
    }
    return 8;
};
The Gantt Config Script supports Velocity expressions ($project, $user, $trackerService). Velocity runs on the server before the script reaches the client. Use this to dynamically build script content based on Polarion data.

Template Functions (gantt.templates)

Override rendering templates to customize how task elements display:

Right-Side Text

Display custom text to the right of each task bar:
gantt.templates.rightside_text = function(start, end, task) {
    return (task.progress > 0
        ? "Progress: <b>" + Math.round(task.progress * 100) + " %</b>"
        : "");
};

Right-Side Text with Status Icon

gantt.templates.rightside_text = function(start, end, task) {
    return "<b><img src='" + task.fields.statusIcon + "'/> "
        + task.fields.statusName + "</b> "
        + (task.progress != null ? task.fields.progressString : "");
};

Status Icon Only

gantt.templates.rightside_text = function(start, end, task) {
    return "<b><img src='" + task.fields.statusIcon + "'/></b>";
};
Template functions access data prepared by the Item Script via task.fields.*. Prepare your data in the Item Script using task.getFields().put(KEY, VALUE), then reference it in templates as task.fields.KEY.

Common Configuration Patterns

gantt.config.drag_links = false;

Disable Progress Dragging

gantt.config.drag_progress = false;

Enable Static Coloring

Disable dynamic progress-based colors to use only task.color values set in the Item Script:
gantt.config.show_progress_colors = false;

Combined Example

gantt.config.drag_progress = false;
gantt.config.show_progress_colors = false;
gantt.templates.rightside_text = function(start, end, task) {
    return (task.fields.owner
        ? "Owner: <b>" + task.fields.owner + "</b>"
        : "");
};

REST API Endpoints

The Gantt chart communicates with the server via these REST API endpoints:
EndpointMethodDescription
gantt/api/dataGETServes Gantt data (tasks, links, resources). Requires config query parameter.
gantt/api/confGETServes Gantt configuration data.
gantt/api/fieldsGETReturns custom field metadata for the lightbox form.
api/clearCalendarCacheGETClears the server-side working calendar cache. Call after modifying calendar work items when caching is enabled.
All Gantt API endpoints require Polarion user authentication. Anonymous access is not supported.

Error Handling

  • Script errors display as a warning indicator with a count badge in the Gantt toolbar
  • Config Script Error: prefix identifies errors from this script
  • Markers Script Error: prefix identifies errors from the markers script
  • Item Script Error: prefix identifies errors from the Item Script
  • Errors appear in both view mode and wiki editor mode with different messages

Configuration Example

A complete Gantt Config Script for a project tracking view:
// Disable progress drag (calculated in Item Script)
gantt.config.drag_progress = false;

// Set custom working hours
gantt.config.workingHoursPerDay = 7;

// Custom right-side text showing progress info
gantt.templates.rightside_text = function(start, end, task) {
    return "<b><img src='" + task.fields.statusIcon + "'/> "
        + task.fields.statusName + "</b> "
        + (task.progress != null ? task.fields.progressString : "");
};
KB ArticlesSupport TicketsSource Code
  • prod-gantt-src/com.nextedy.polarion.gantt.client/src/js/scripts.js
  • prod-gantt-src/com.nextedy.polarion.gantt.client/src/js/config.js
  • prod-gantt-src/com.nextedy.polarion.gantt/src/com/nextedy/polarion/gantt/widget/PlansGanttWidget.java
  • prod-gantt-src/com.nextedy.polarion.gantt.client/src/js/nextedy.js
  • prod-gantt-src/com.nextedy.polarion.gantt.client/src/js/default.json