2

I want to change the colors of tasks in a timeline that I have. Can this be done? How?

Thanks you!

3

To manually change event/callout colors in a timeline or project summary:

  1. Go to your task list
  2. Select the Task in the timeline (opens the Timeline menu)
  3. Click the paint bucket and/or the font color icons to specify the colors of a specific event in the timeline.

The font color obviously will change the color of the text identifying a task. For tasks with a start and end date that show as a bar, the paint bucket changes the fill color of the task. For callouts (events with only a start OR due date) the paint bucket changes the color of the line connecting the callout text to the timeline.

Note that if you have a project summary associated with the task list, changing the colors of the task list will also affect the project summary (and vice versa).

0

For the people who is looking for change the timeline color based on status, use the following code.

    <script src="http://code.jquery.com/jquery-1.10.2.js" type="text/javascript"></script>
<script type="text/javascript">
    _spBodyOnLoadFunctionNames.push("updateColors");

    setTimeout(
        function updateColors() {
            debugger;
            $(".ms-tl-mainArea .ms-tl-barTitle").each(function () {
                var taskStatus = getTaskStatus($(this).text());
                if (taskStatus == "Raised") {
                    $(this).parent().css("background-color", "#FFBF00");
                }
                if (taskStatus == "In Progress") {
                    $(this).parent().css("background-color", "green");
                }
                if (taskStatus == "Completed") {
                    $(this).parent().css("background-color", "blue");
                }
            });
        }, 5000);

    function getTaskStatus(taskname) {
        debugger;
        var status = "";
        var nameIndex = 0;
        var statusIndex = 0;

        //get Task Name column index and Task Status column index
        $(".ms-listviewtable tr th").each(function (i) {
            if ($(this).find("a").text() == "InitiativeName") {
                nameIndex = i;
            }
            if ($(this).find("a").text() == "Status") {
                statusIndex = i;
            }
        });

        $(".ms-listviewtable tr").each(function (i) {
            if (i > 0) {
                var name = $(this).children("td").eq(nameIndex).text();
                if (name == taskname) {
                    status = $(this).children("td").eq(statusIndex).text();
                }
            }
        });
        return status;
    }
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.