Customizing the Gantt Time Scale

Article ID: 2229
Last updated: 29 May, 2018
Article ID: 2229
Last updated: 29 May, 2018
Revision: 3
Views: 689
Posted: 08 Jun, 2010
by Dean J.
Updated: 29 May, 2018
by Gargani A.

Question

How can I customize the Gantt time scale? Is it possible to add or change scale rows?

Answer

Up to JViews 5.0, IlvGanttTimeScale does not

allow any of the predefined rows to be replaced, nor any customized rows to be

added. Starting with JViews 5.5 this limitation has been removed, which means

that you can not only access the predefined rows of IlvGanttTimeScale and customize them using their documented API,

but also replace the predefined ones or plug in your own customized rows.



To access the time scale rows, you need to know the association between the index of time scale rows which underlies the time scale:

0: IlvGanttYearScaleRow

1: IlvGanttYearScaleRow

2: IlvQuarterTimeScaleRow

3: IlvMonthTimeScaleRow

4: IlvWeekTimeScaleRow

5: IlvDayTimeScaleRow

6: IlvHourTimeScaleRow

7: IlvMinuteTimeScaleRow

The following is how to replace the default hour time scale row with a customized row which has eight hours per shift instead of default four hours:

IlvGanttTimeScale timescale = new IlvGanttTimeScale();

timescale.setRow(6, new IlvHourTimeScaleRow(){

public void setHourStep(int value){

super.setHourStep(8);

}

});

ganttChart.setTimeScale(timescale);

Here is an example of plugging in your own time scale row and keep it

visible:

IlvGanttTimeScale scale = new IlvGanttTimeScale();

scale.addRow( new YourTimeScaleRow(){

public void setVisible(boolean visible){

super.setVisible(true);

}

});

ganttChart.setTimeScale(scale);

You can place the attached sample and place it in the JVIEWS_HOMEsamplesganttChart to see the effect of the changes here made.

Starting with JViews 6.0, time scales are completely customizable and the API has been exposed to fully support this. Take a look at the new relativeTimeScale sample that we provide which illustrates some of these features.

(see the documentation Developing with the SDK > Gantt Charts > Using the

Timescale > Changing the Rows of a Timescale for more details).

Also, to control which rows are visible, the concept of visibility policy has

been introduced on the Gantt time scale. (See the documentation Developing with

the SDK > Gantt Charts > Using the Timescale > Visibility Policy for more

details).

This article was:   Helpful | Not helpful
Report an issue
Article ID: 2229
Last updated: 29 May, 2018
Revision: 3
Views: 689
Posted: 08 Jun, 2010 by Dean J.
Updated: 29 May, 2018 by Gargani A.
Attached files

Also listed in


Others in this category