Articles in this section
Category / Section

How to change baseline color for specific tasks in a project for JS Gantt Chart?

2 mins read

Baselines are used to represent the original start date and end date of a task, scheduled at the beginning of the project. In JavaScript Gantt, it is possible to render the baseline using renderBaseline property and we can define the baseline color using baselineColor property at load time.

It is also possible to change this color dynamically for some tasks with the help of queryTaskbarInfo client side event.

The following code example shows you how to enable baseline and change its line color dynamically at run time based on condition in Gantt control.

$("#GanttContainer").ejGantt({
        //...
        baselineStartDateMapping: "BaselineStartDate",
        baselineEndDateMapping: "BaselineEndDate",
        renderBaseline: true,
        queryTaskbarInfo: function (args) {
            if (args.data.taskId == "2" || args.data.taskId == "3")
                args.baselineBackground = "red";
        }
  });

The following screenshot shows the baseline in Gantt control.

Enable baseline and change the baseline color for specific row.

Sample link

A sample to render baseline in Gantt chart is available in the following link, Sample

Conclusion

I hope you enjoyed learning about how to change baseline color for specific tasks in a project.

You can refer to our JavaScript Gantt feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our JavaScript Gantt example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied