ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Gantt Chart
Posted by Joe on Apr-21-2011 21:32
Hello,
i am building a gantt chart starting with the demo that is provided in the ChartDirector Support (PHP). I have my rows populated with various tasks, which have a start/end date assigned to map out their bars. Each of these tasks also have a percent completion that I would like to layer above the previous bars, to show how far along a task is, in relation to its time span. Is there a built in function where I can plugin in a percent to indicate this on the chart? Thank you.

  Re: Gantt Chart
Posted by Peter Kwan on Apr-21-2011 23:20
Hi Joe,

Do you mean you would like to put another bar on top of your existing bars, in which the bar length represents the percentage completion? If this is the case, you may use the "Multi-Layer Gantt Chart" sample code as a reference. It demonstrate how you can put two bars in a task. You can use the top bar to represent the percentage completion.

In case you are not sure how to set the start and end date of the top bar, the start date of the top bar is the same as the start date of the bottom bar, and the length of the top bar is just a percentage of the total duration of the bottom bar, like:

$topBarStartDateArray = $bottomBarStartDateArray;
for ($i = 0; $i < count($topBarCompletionArray); ++$i)
    $topBarEndDateArray[$i] = $topBarStartDateArray[$i] + $topBarCompletionArray[$i] * ($bottomBarEndDateArray[$i] - $bottomBarStartDateArray[$i]);

In the above, the $topBarCompletionArray is an array holding numbers from 0 to 1, indicating the portion that is completed.

Hope this can help.

Regards
Peter Kwan

  Re: Gantt Chart
Posted by Joe on Apr-22-2011 02:27
Thank you this helped.