10619 : Controlling z order of time items

Question

When I add several TimeItems to a Gantt row (where times overlap each other) they all appear; however are split horizontally across the Grid displaying several thin TimeItems.

What I really want, is a single row to be shown, where the last item added will overwrite (appear on top) of the other items. I know I could iterate through the different time items and calculate where each starts/stops to ensure the times don’t overlap (resulting in a single row) but this will take some time.

Can this be achieved by using different Layers?

Answer

First you may turn off the automatic collision detection by setting the IphGantRow3.CollisionDetect=false.

But to further control the z-order of drawing (which time item that is drawn on top of another) you should place your time items on different layers.

If you add a time item to layer zero and one to layer one it would look like this:

layer0_TimeItem=phGantX.AddGantTime(0)
layer1_TimeItem=phGantX.AddGantTime(1)

The deafult drawing order is from 0 to n. You can control where the drawing starts (maybe you want a “send to back” choice on your time item) and this is controlled by the IphGantRow3.DrawLayerStart property.

This is the help file description of the IphGantRow3.DrawLayerStart property

Since there can be many datalists on a GantRow, you can use these different lists as layers. In order to control in wich order the layers are drawn you set the drawLayerStart property. Say that you have 5 layers or datalist. Then they will span from 0 to 4 and normally be drawn 0,1,2,3,4. When you set DrawLayerStart to 3 for exemple they will be drawn in the following order: 3,4,0,1,2.

 

Leave a Reply