Our state of the art Gantt chart


Post by josevmichael »

Hi,
I have a query regarding the color of the IsCritical bar when IsCritical is 'YES' then the bar is shown as green, how can we set bar color to red if the isCritical value is 'YES'.
Thank you.

Attachments
criticalcolor1.PNG
criticalcolor1.PNG (73.12 KiB) Viewed 169 times

Post by tasnim »

Hi,
You can use https://bryntum.com/docs/gantt/api/Gantt/view/GanttBase#config-taskRenderer

Example:

taskRenderer({ taskRecord, renderData }) {
    if (isCritical) {
        renderData.style = 'background-color : red';
    }
}

Post by josevmichael »

Can we set the color based on the value on the column, If the IsCritcal value on the column is 'YES' then we have to show the bar in Red color and If value is 'NO' then show the bar in the default color.


Post by mats »

Sure, just read this field from your model:

taskRenderer({ taskRecord, renderData }) {
    if (taskRecord.isCritical) {
        renderData.style = 'background-color : red';
    }
}

Post by josevmichael »

The code that you given worked successfully, Thank you for your response


Post Reply