RadiantQ jQuery Gantt Package
How to make Custom Progress Calculation?
Previous Topic  Next Topic 


CustomProgessCalculation


A custom logic that will be used, to calculate the progress value of a summary bar. It gives you the option to calculate the progress value. Set this option before setting the ItemsSource property to the Gantt.


Here is the code example:


$('#gantt_container').GanttControl({

    CustomProgressCalculation: CustomProgressCalculationCallback,


});


// Implements progress calculation logic that's similar to MS Project.

function CustomProgressCalculationCallback(parentActivity) {

    var totalEffort = RQTimeSpan.Zero_M();

    var completedEffort = RQTimeSpan.Zero_M();


    for (var i = 0; i < parentActivity.ChildActivities_M().length; i++) {

        var child = parentActivity.ChildActivities_M()[i];

        var childEffort = child.CumulativeEffort_M();

        totalEffort = totalEffort.add(childEffort);

        completedEffort = completedEffort.add(RQTimeSpan.fromTicks(childEffort.Ticks_M() * (child.ProgressPercent_M() / 100)));

    }


    if (totalEffort == RQTimeSpan.Zero_M())

        return 0.0;

    else

        return (completedEffort.Ticks_M() / totalEffort.Ticks_M()) * 100.0;

}



This is illustrated in this samples:

In HTML                : ...\Samples\GanttTaskBarBrowseToCue.htm



� RadiantQ 2022. All Rights Reserved.