Contents Previous Next

### 9.8.2 Hour scale

The hour scale has more builtin formatting possibilities. The following formatting options are available

1. "HOURSTYLE_HM24", Will display the only the hour in military time 0-24 , for example 13:00
2. "HOURSTYLE_H24", Will display the hour with both hour and minute in military time 0-24, for example 13
3. "HOURSTYLE_HMAMPM", Will display the hour and minutes with a suitable am/pm postfix, for example 1:30pm
4. "HOURSTYLE_HAMPM", Will display only the hour with a suitable am/pm postfix, for example 1pm
5. "HOURSTYLE_CUSTOM", Custom defined format as specified with a call to HeaderProperty::SetFormatString()

For hours it is possible to specify the interval in either of two ways. With an integer, e.g. 6, or as time interval, e.g. "1:30" which makes the interval one and a half hour. The only restriction is that the interval must be even dividable for 24 hours since one day is the smallest possible interval to show. This means that it is allowed to use, for example 2,4,6,"1:30" or "0:45" as intervals but not 7, "2:45".

The code snippet below shows hot to set up a hour scale to with 45 minutes interval and some custom colors

`$graph ->scale->hour-> SetBackgroundColor( 'lightyellow:1.5');
$graph->scale-> hour->SetFont(FF_FONT1 );
$graph->scale-> hour->SetStyle(HOURSTYLE_HMAMPM);
$graph->scale-> hour-> SetIntervall( "0:45");`

The example below shows a gantt chart with the day and hour scale enabled

Figure 160: Using hour scale in the Gantt chart [src]

Contents Previous Next