private taskMainRectRender()

in src/gantt.ts [2259:2303]


    private taskMainRectRender(
        taskSelection: Selection<Task>,
        taskConfigHeight: number): void {
        const highContrastModeTaskRectStroke: number = 1;

        let taskRect: Selection<Task> = taskSelection
            .selectAll(Selectors.TaskRect.selectorName)
            .data((d: Task) => [d]);

        const taskRectMerged = taskRect
            .enter()
            .append("path")
            .merge(taskRect);

        taskRectMerged.classed(Selectors.TaskRect.className, true);

        let index = 0, groupedTaskIndex = 0;
        taskRectMerged
            .attr("d", (task: Task) => this.drawTaskRect(task, taskConfigHeight))
            .attr("width", (task: Task) => this.getTaskRectWidth(task))
            .style("fill", (task: Task) => {
                // logic used for grouped tasks, when there are several bars related to one category
                if (index === task.index) {
                    groupedTaskIndex++;
                } else {
                    groupedTaskIndex = 0;
                    index = task.index;
                }

                const url = `${task.index}-${groupedTaskIndex}-${isStringNotNullEmptyOrUndefined(task.taskType) ? task.taskType.toString() : "taskType"}`;
                const encodedUrl = `task${hashCode(url)}`;

                return `url(#${encodedUrl})`;
            });

        if (this.colorHelper.isHighContrast) {
            taskRectMerged
                .style("stroke", (task: Task) => this.colorHelper.getHighContrastColor("foreground", task.color))
                .style("stroke-width", highContrastModeTaskRectStroke);
        }

        taskRect
            .exit()
            .remove();
    }