> ## Documentation Index
> Fetch the complete documentation index at: https://learn.nextedy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Write Gantt Config Scripts

> Use the Gantt Config Script to customize global chart behavior, templates, and visual settings for a specific Nextedy GANTT widget instance.

export const LastReviewed = ({date}) => {
  if (!date) return null;
  const formatted = new Date(`${date}T00:00:00Z`).toLocaleDateString("en-US", {
    year: "numeric",
    month: "long",
    day: "numeric",
    timeZone: "UTC"
  });
  return <p className="mt-10 text-sm text-gray-400 dark:text-zinc-500 not-prose">
      Last reviewed on {formatted}
    </p>;
};

## Prerequisites

* A Gantt widget added to a Polarion LiveDoc or Wiki page
* Access to the widget parameter editor (Edit mode on the page)

## Open the Config Script Editor

1. Open the page containing your Gantt widget in edit mode.
2. In the widget parameters panel, locate the **Advanced** section.
3. Find the **Gantt Config Script** parameter and click to expand the script editor.

This script runs once during chart initialization. Any `gantt.config.*` properties you set here override system defaults and administration-level Configuration Properties for this specific widget instance.

## Understand the Script Scope

The Gantt Config Script executes with access to these objects:

| Object    | Purpose                                                                       |
| --------- | ----------------------------------------------------------------------------- |
| `gantt`   | The chart instance with `gantt.config`, `gantt.templates`, and event handlers |
| `config`  | The Nextedy configuration object with widget parameters and context           |
| `Nextedy` | The Nextedy singleton exposing markers, editors, and license info             |

<Frame>
  <img src="https://mintcdn.com/none-17b4493f/umKaPvHwUHw-ZQFM/gantt/diagrams/guides/scripting/gantt-config-script/diagram-1.svg?fit=max&auto=format&n=umKaPvHwUHw-ZQFM&q=85&s=0a143807d840f6672c98fc67c95e8181" alt="diagram" style={{ maxWidth: "740px", width: "100%" }} width="740" height="70" data-path="gantt/diagrams/guides/scripting/gantt-config-script/diagram-1.svg" />
</Frame>

Configuration Properties set system-wide defaults. Widget parameters override those defaults per instance. The Gantt Config Script runs last and can override both.

## Common Configuration Patterns

### Disable Progress Drag

Prevent users from adjusting progress by dragging the task bar fill:

```javascript theme={null}
gantt.config.drag_progress = false;
```

### Set Custom Resolved Color

Override the default color for resolved work items while keeping progress-related coloring active:

```javascript theme={null}
gantt.config.progress_color_resolved = "#0AA33A";
```

You can also set this globally via the Configuration Property `nextedy.gantt.default.progress_color_resolved`.

### Enable Square Task Borders

Switch from rounded to square task bar borders:

```javascript theme={null}
gantt.config.squareTaskBorder = true;
```

<Tip title="Global vs. per-widget configuration">
  Set `nextedy.gantt.config.squareTaskBorder=true` in Administration > Configuration Properties to apply square borders globally. Use `gantt.config.squareTaskBorder = false` in the Gantt Config Script to override the global setting for a specific chart.
</Tip>

### Customize Right-Side Text

Display a custom label to the right of each task bar using the `rightside_text` template:

```javascript theme={null}
gantt.templates.rightside_text = function(start, end, task) {
    return task.progressString || "";
};
```

### Disable Auto-Scheduling

Turn off automatic date propagation for this chart instance:

```javascript theme={null}
gantt.config.auto_scheduling = false;
```

The system default is controlled by `nextedy.gantt.default.auto_scheduling` (default: `false`).

## Configuration Properties Reference

These `nextedy.gantt.*` properties can be set in Administration > Configuration Properties as system-wide defaults:

| Property                                  | Default   | Purpose                |
| ----------------------------------------- | --------- | ---------------------- |
| `nextedy.gantt.default.auto_scheduling`   | `false`   | Enable auto-scheduling |
| `nextedy.gantt.default.critical_path`     | `false`   | Show critical path     |
| `nextedy.gantt.config.squareTaskBorder`   | `false`   | Square task borders    |
| `nextedy.gantt.workitems.unplanned_color` | `#7D3C98` | Unplanned item color   |
| `nextedy.gantt.today.color`               | `gray`    | Today marker color     |
| `nextedy.gantt.debug`                     | `false`   | Enable debug messages  |

<Warning title="Script execution order matters">
  The Gantt Config Script runs during chart initialization. If you modify `gantt.config` properties after the chart renders, call `gantt.render()` to apply changes. Template functions (like `rightside_text`) take effect on the next render cycle automatically.
</Warning>

## Handle Script Errors

When the Gantt Config Script contains a syntax or runtime error, the chart displays a warning indicator in the footer. In edit mode, clicking the indicator shows the error details prefixed with **Config Script Error:**. In view mode, a triangle icon appears as a warning.

Check the browser console for detailed error messages. See [Debug Script Errors](/gantt/guides/scripting/debug-scripts) for a systematic debugging approach.

## Verify Your Changes

After saving the page, reload the Gantt chart. You should now see your configuration changes reflected:

* Modified task bar styles or colors appear immediately
* Template changes (right-side text, tooltips) render with each task bar
* Disabled features (drag progress, auto-scheduling) no longer respond to user interaction

## See Also

* [Write Item Scripts](/gantt/guides/scripting/item-script-basics) for per-task customization
* [Write Page Scripts with Velocity](/gantt/guides/scripting/page-script) for server-side pre-processing
* [Color Logic Script Examples](/gantt/guides/scripting/color-logic-scripts) for color customization patterns
* [Customize Progress-Related Coloring](/gantt/guides/visualization/progress-coloring) for progress color configuration
* [Debug Script Errors](/gantt/guides/scripting/debug-scripts) for troubleshooting script issues

<LastReviewed date="2026-07-02" />
