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.
Unfortunately, activation email could not send to your email. Please try again.

Percentage calculation problem

Thread ID:

Created:

Updated:

Platform:

Replies:

118244 Feb 16,2015 01:09 AM Feb 18,2015 11:20 PM ASP.NET Web Forms 4
loading
Tags: Gantt
Hasan Kosten
Asked On February 16, 2015 01:09 AM

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!

Hasan Kosten
Replied On February 16, 2015 01:48 AM

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.

John Rajaram [Syncfusion]
Replied On February 17, 2015 03:34 AM

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



Hasan Kosten
Replied On February 18, 2015 02:13 PM

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

I really appreciate your time helping me solve this problem.

John Rajaram [Syncfusion]
Replied On February 18, 2015 11:20 PM

Hi Hasan,
Thanks for the update.

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

Regards,

John. R



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;