summary
The functionality is available in PRO Edition only
PRODescription
Optional. Configures advanced summary task behaviorThe summary property enables advanced, built-in behavior for summary tasks. When enabled, Gantt automatically manages summary task logic such as:
- calculating summary progress based on child tasks
- converting parent tasks to summary tasks and back
Usage
summary?: {
autoProgress?: boolean,
autoConvert?: boolean,
};
Parameters
autoProgress- (optional) when set to true, the progress of summary tasks is calculated automatically based on the progress of their child tasks. The calculation uses the formula∑(duration × progress) / ∑durationwhere:- duration is the task duration in days
- progress is the task progress value
autoConvert- (optional) when set to true, tasks with child items are automatically converted into summary tasks. If all child tasks are removed, the task is automatically converted back to a regular task.
Example
import { useRef } from "react";
import { getData } from "../data";
import { Gantt, ContextMenu } from "@svar-ui/react-gantt";
const Example = () => {
const data = getData();
const apiRef = useRef(null); // ref to access Gantt API
return (
<ContextMenu api={apiRef}>
<Gantt
ref={apiRef}
tasks={data.tasks}
links={data.links}
scales={data.scales}
cellWidth={30}
summary={{
autoProgress: true,
autoConvert: true
}}
/>
</ContextMenu>
);
};
Related article: Configuring summary tasks