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

Message ListMessage List     Post MessagePost Message

  Custom Gantt chart
Posted by Marko on Aug-13-2013 20:57
Attachments:
Hi Peter

Is it possible to customize a Gantt chart such that:
- Labels are aligned to the bottom
- Every task has its own color
- Every task is aligned to the bottom and has a different height

It is a mixture between a Gantt and a Bar chart, see the attachment.
Gantt_Chart_custom.png

  Re: Custom Gantt chart
Posted by Peter Kwan on Aug-14-2013 03:52
Hi Marko,

Moving the labels is easy. You may use Axis.setLabelOffset. For example:

$c->xAxis->setLabelOffset(0.2);

For the bars, the easiest method I can think of is to use a bubble chart with rectangular
bubbles for the rectangles. It is like:


for ($i = 0; $i < count($startDate); ++$i)
{
    $layer = $c->addScatterLayer(array($taskNo[$i] + 0.5 - $height[$i] / 2),
array($startDate[$i] + $endDate[$i]) / 2, "", SquareSymbol, 9, $colors[$i],
SameAsMainColor);
    $layer->setSymbolScale(array($height[$i]), XAxisScale, array($endDate[$i] -
$startDate[$i]), YAxisScale);
}

$c->xAxis->setIndent(true);


In the above, $startDate and $endDate are arrays containing the starting and ending
date/time of the task. $taskNo is an array containing the array index of the task (0 for
the first task, 1 for the second task, .....). $height is an array for the height of the bars
from 0 to 1 (0 = zero height, 1 = full height). $colors is an array containing the color of
the bars.

Hope this can help.

Regards
Peter Kwan

  Re: Custom Gantt chart
Posted by Marko on Aug-19-2013 21:11
Attachments:
Thanks Peter!

Can you tell me how to get rid of the margins? The margin appears after boxes are shifted (aligned) to the bottom line, see attachment. I need rows with equal height.
space.png

  Re: Custom Gantt chart
Posted by Peter Kwan on Aug-19-2013 22:28
Hi Mark,

Instead of using something like:

$c->xAxis->setLabels($labels);

may be try to change the above to:

$c->xAxis->setLinearScale(0, count($labels) - 1, $labels);

Hope this can help.

Regards
Peter Kwan