Each task has an onRender callback which we call like this: task.onRender(task, segment, taskBar, segmentElement, labelWrapper);
We pass the task and the HTML Elements of the task so you can apply conditional rendering depending on task details. Hope this helps for the Gantt chart.