We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Percentage calculation problem

Hello again,

I have a main task, which has 4 subtasks. Each subtask includes one or more items. I'm calculating the percentage in the background as 37.5, putting it to main task, but it shows as 44 as stated in the image attached.

How can I fix this?

Thank you!

4 Replies

HK Hasan Kosten February 16, 2015 06:48 AM UTC

I found the problem. The Gantt chart calculates percentage by looking the day count in a task process. But I want to calculate the percentage myself, by completed jobs and their % in the tasks. How can I accomplish this?

Thank you.


JR John Rajaram Syncfusion Team February 17, 2015 08:34 AM UTC

Hi Hasan,

Thanks for using Syncfusion products.

In the Gantt control, the percentage of the parent task item is calculated based on the duration and percentage of its total child task items, which is the behavior of the Gantt chart. But we would also like to let you know that, you can also customize your percentage value of the parent task item of the Gantt control. We have prepared a workaround sample using “Load” client side event for changing the values of the parent task item.

Please refer the below code snippets for more details.

Code snippets:

<body>

<form id="form1" runat="server" onsubmit="return false" style="overflow: hidden; padding:0; margin: 0;height:100%;width:100%;">

<ej:Gantt ID="Gantt" runat="server"

Load="Load"

//...

ej:Gantt>

<script type="text/javascript">

function Load(args) {

var totalParentRecords = args.model.parentRecords.length,

parentItems = args.model.parentRecords;

for (var i = 0; i < totalParentRecords; i++) {

if (parentItems[i].taskId == 1)

parentItems[i].status = "50";

if (parentItems[i].taskId == 5)

parentItems[i].status = "56";

if (parentItems[i].taskId == 10)

parentItems[i].status = "46";

}

}

</script>

</form>

</body>

We have prepared a sample based on this. Please find the sample in the following location.

Sample: http://www.syncfusion.com/downloads/support/directtrac/118244/GanttTestSamplePercentage-1992491787.zip

Please let us know if you need further assistance on this.

Regards,
John. R




HK Hasan Kosten February 18, 2015 07:13 PM UTC

Thank you very much for the fast response and the example code. 

I really appreciate your time helping me solve this problem.


JR John Rajaram Syncfusion Team February 19, 2015 04:20 AM UTC

Hi Hasan,
Thanks for the update.

Please let us know, if you require any further assistance on this.

Regards,

John. R



Loader.
Up arrow icon