# Overlay sample is incorrect

Hi,

I’ve tried the overlay sample because i want to intergrate it to my project but this sample doesn’t work well.
The real progress in the graph is incorrect.

Way to reproduce with the sample code without modification :

• create a task with duration = 2 days
• after the first task, create a second task with duration = 2 days

If i put 100% progress on the first task and 50% progress on the second, on the middle of the second task, the graph indicate : planned=75% and real=63%.
The real progress should be 75%.
No ?

Hello,
I see that the final progress is 100%/75%.
If you hover the mouse over the previous day, you will see 75%/63%.
The displayed value depends on the point you highlight:

How can the script find 63% ?

In the previous day, i see : planned 75%, real 63%
Why the real value is 63% ? That correspond to nothing.
The normal value should be 75% for both planned and real. No ?

Hello,
The dev team decided that if you calculate the progress, it should consider days when calculating the total progress.
Here is a small demonstration of how it calculates the progress:

Day 1: half of task #1 + 0 + 0 + 0
Day 2: half of task #1 + half of task #1 + 0 + 0
Day 3: half of task #1 + half of task #1 + half of task #2 + 0

half of task #1 progress: 100% / 2 = 50%;
half of task #1 progress: 50% / 2 = 25%;

Total progress:
Day 1: (50% + 0% + 0% + 0%) / 2 tasks = 25%
Day 2: (50% + 50% + 0% + 0%) / 2 tasks = (100% + 0%) / 2 tasks = 50%
Day 3: (50% + 50% + 25% + 0%) / 2 tasks = (100% + 25%) / 2 tasks = (125%) / 2 tasks = 62.5%
Day 4: (50% + 50% + 25% + 25%) / 2 tasks = (100% + 50%) / 2 tasks = (150%) / 2 tasks = 75%

You can use any logic in the overlay configuration.

I don’t think it’s the good way to calculate it.
Why to not calculate like this for each day :

total_sum = sum of duration of all task duration
progress sum = Sum of (duration X % progress) of each task :

total progress = progress sum / total sum X 100

Why do you think of it ?

Hello,
It might be a good way to change the logic, but actually, there are 3 things:
`real`, `actual` and `predicted`:

And `predicted` uses `real` and `actual` values.

Do you want to see a snippet where your logic is applied?

Hi Can u give the snippet for the above logic

I also have an issue where the planned progress doesn’t start from zero for some projects
It starts at 10 percent or something in most cases for our project

Hello,

Hi Can u give the snippet for the above logic

Here is the snippet with the S-Curve overlay:
https://snippet.dhtmlx.com/5/8fa0ce163

And you can also press Control + U to see the source code of the page:
https://docs.dhtmlx.com/gantt/samples/02_extensions/21_overlay.html
Then you will get the following link:
`view-source:https://docs.dhtmlx.com/gantt/samples/02_extensions/21_overlay.html`

Starting from the 8.0 version, you can click on the `Source code` tab in the sample viewer to see the source code of the sample:
https://docs.dhtmlx.com/gantt/samples/?sample='02_extensions/21_overlay.html'&filter='overlay'

I also have an issue where the planned progress doesn’t start from zero for some projects
It starts at 10 percent or something in most cases for our project

Probably, the issue is related to the Gantt configuration, but it is hard to suggest what might be wrong as I don’t see your code.
Please add your configuration to the following snippet and make sure that the issue is reproduced there:

Then, click on the `Save` button and send me the link.
Or send me a ready demo with all the necessary JavaScript and CSS files so that I can reproduce the issue locally.