Our state of the art Gantt chart


Post by bherford »

Hello Team,

I am working on changing the color of my tasks within my Gantt chart. I am trying to use a "color " property with a HEX value that I receive in my data.

        {
            "id": 424192,
            "projectId": "728",
            "pullPlanTargetId": 359,
            "resourceId": "13426899",
            "parentTaskId": 424190,
            "parentTaskp6Id": "",
            "location": "",
            "type": "Task",
            "name": "Rough in wall electric and LV 2nd floor",
            "startDate": "2020-12-25",
            "duration": 1,
            "resourceQuantity": 5,
            "highHazardActivity": false,
            "color": "#FDD017"
        },

I've read through the guide here https://www.bryntum.com/blog/styling-your-tasks-part-1-built-in-styling/ but I have not been able to change my task color at all, much less dynamically from my data.

Is this something you can help me with?

Thanks!


Post by alex.l »

You could apply any CSS you want using https://bryntum.com/docs/gantt/api/Gantt/view/GanttBase#config-taskRenderer
and renderData.style property. So just transform the data from task.color field to CSS rule and apply it to renderData.style.

All the best,
Alex


Post by bherford »

Thanks Alex that helped.

I also had to add the taskrenderer to my component.html.

Works now!


Post Reply