> ## 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.

# Track and Calculate Progress

> This guide shows you how to display, calculate, and customize task progress in Nextedy GANTT using the built-in progress field, drag interaction, and scripting.

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 configured with a **Progress Field** mapping (default: `gantt_progress`)
* Edit mode access to modify widget parameters

## Understand the Progress Field

The `progressField` widget parameter specifies which Polarion work item field stores the completion percentage. Progress values are stored as a float between `0.0` (not started) and `1.0` (complete). The Gantt chart displays this as a filled portion inside the task bar.

| Property           | Default Value    | Description                                       |
| ------------------ | ---------------- | ------------------------------------------------- |
| `progressField`    | `gantt_progress` | Work item field storing progress (0.0-1.0)        |
| `drag_progress`    | `true`           | Enable or disable progress drag on task bars      |
| `progressColoring` | `true`           | Color-code task bars based on progress percentage |

The `progress` system column displays the value as 0-100 in the grid, while the internal task model stores it as 0.0-1.0.

<Note>
  Progress drag is enabled by default (`gantt.config.drag_progress = true`). To prevent users from adjusting progress by dragging the task bar, disable it in the Gantt Config Script with `gantt.config.drag_progress = false;`.
</Note>

## Control Progress Drag

Progress drag is on by default. To set it explicitly (or re-enable it where a Config Script turned it off), use the Gantt Config Script:

1. Open the Polarion page containing the Gantt widget
2. Edit the widget properties
3. Navigate to **Advanced > Gantt Config Script**
4. Add the following line:

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

<Tip>
  The progress drag handle is only visible when the Gantt is in **Edit mode**. Click the **Edit** button in the toolbar before attempting to drag the progress bar.
</Tip>

## Calculate Progress from Time Estimates

For short-to-mid-term items where you want to compute progress automatically based on time tracking data, use an **Item Script**:

1. Navigate to **Widget Properties > Advanced > Item Script**
2. Add the following script:

```javascript theme={null}
var all = (wi.getRemainingEstimate() != null
            ? wi.getRemainingEstimate().getHours() : 0)
        + (wi.getTimeSpent() != null
            ? wi.getTimeSpent().getHours() : 0);
var done = (wi.getTimeSpent() != null
            ? wi.getTimeSpent().getHours() : 0);

if (wi.getResolution() != null) {
    task.progress = 1;
} else if (all == 0) {
    task.progress = 0;
} else {
    task.progress = done / all;
}

var progressString = (wi.getTimeSpent() != null ? wi.getTimeSpent() : "0h")
    + " | "
    + (wi.getRemainingEstimate() != null ? wi.getRemainingEstimate() : "0h")
    + " (" + Math.round(task.progress * 100) + " %)";
task.getFields().put("progressString", progressString);
```

This script computes progress as `timeSpent / (remainingEstimate + timeSpent)`. Resolved items automatically show 100% progress.

<Note>
  To limit progress calculation to a specific type (for example, `workpackage`), wrap the script in a type check: `if (wi.getType().getId() === 'workpackage') { ... }`.
</Note>

3. Disable manual drag when using automatic calculation. In **Advanced > Gantt Config Script**, add:

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

## Show Progress Text on Task Bars

To display the calculated progress alongside the task bar, add the following to **Advanced > Gantt Config Script**:

```javascript theme={null}
gantt.templates.rightside_text = function(start, end, task) {
    return (task.progress > 0
        ? "Progress: <b>" + Math.round(task.progress * 100)
          + " % (" + task.fields.progressString + ")</b>"
        : "");
};
```

This renders a label to the right of each task bar showing the progress percentage and time breakdown.

## Calculate Epic or Plan Progress

For parent items like epics or plans, you can compute progress as the ratio of resolved children to total children. Use this **Item Script** pattern for Plans Gantt:

```javascript theme={null}
var allitems = trackerService.queryWorkItems(
    "PLAN:(" + plan.getProjectId() + "/" + plan.getId() + ")", "id").size();
var openitems = trackerService.queryWorkItems(
    "PLAN:(" + plan.getProjectId() + "/" + plan.getId()
    + ") AND HAS_VALUE:resolution", "id").size();
if (allitems > 0) {
    task.progress = openitems / allitems;
} else {
    task.progress = 0;
}
task.getFields().put("progressString", openitems + " / " + allitems + " done");
```

<Frame>
  <img src="https://mintcdn.com/none-17b4493f/DDjWgCW2DWY5biNv/gantt/diagrams/guides/editing/progress-tracking/diagram-1.svg?fit=max&auto=format&n=DDjWgCW2DWY5biNv&q=85&s=599cb21f3ff78ba9a1a20f66fbb73cbf" alt="diagram" style={{ maxWidth: "820px", width: "100%" }} width="820" height="150" data-path="gantt/diagrams/guides/editing/progress-tracking/diagram-1.svg" />
</Frame>

## Verify Your Configuration

After applying the scripts:

1. Open the Gantt chart and enter **Edit mode**
2. You should now see the progress bar filled proportionally inside each task bar
3. If you enabled `rightside_text`, the progress percentage and time breakdown appear to the right of each task bar
4. If you enabled `drag_progress = true`, hover over a task bar to see the drag handle appear on the progress boundary

## See Also

* [Calculate Progress with Scripts](/gantt/guides/scripting/progress-calculation-scripts) for advanced calculation patterns
* [Customize Progress-Related Coloring](/gantt/guides/visualization/progress-coloring) to color-code task bars by progress
* [Configure Right-Side Text on Task Bars](/gantt/guides/visualization/right-side-text) for additional text formatting
* [Compute Plan Progress](/gantt/guides/plans/plan-progress) for Plans Gantt progress setup

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