Contents Previous Next

## 9.8 Formatting the scale headers

The scale headers allow you to view up to four different scales at the same time. The four basic scales are:

- Day scale
- Week scale
- Month scale
- Year scale

You can choose what scale to include and exclude by using the SetScale() method. For example, for a detailed gantt you might choose to display days and weeks by specifying

`$graph ->ShowHeaders ( GANTT_HWEEK | GANTT_DAY );`

If you instead wanted "the big picture" it might be enough to show year and months by specifying

`$graph->ShowHeaders( GANTT_YEAR | GANTT_MONTH );`

You can choose freely the combination of scales that you want, but a chart must at least have one scale of course.

Once you have decided what level of details you need you can then fine tune the exact layout/formatting of each of the enabled scales as described below.

These scale header are all accessed through the graph instance variables 'scale' as in

`$graph->scale-> week`

or

`$graph->scale->day`

. All these headers share the following properties.

- `Show()`

  Determine if the scale should be shown or not

- `SetFont()`

  Font for text in header

- `SetFontColor()`

  Specify the color of the header text

- `SetStyle()`

  Specify what date format should be used, for example in the week scale it is possible to show either week number, the start date of the week and so on.

- `SetBackgroundColor()`

  As it says, the background color for the header

- `SetFrameWeight()`

  The line weight of the box around the scale

- `SetFrameColor()`

  The line color for the frame

- `SetTitleVertMargin()`

  The margin, in percent, below and above the title text

In addition to these methods each scale also has the property 'grid' which determines the appearance of grid lines for that specific scale. You may modify the appearance of grid lines by the "normal" line methods, i.e. SetColor(),SetWeight() SetStyle() and Show(). So for example to set the week grid line red you would use

`$graph ->scale->week-> grid->SetColor("red" );`

Each of the scales also have some specific formatting possibilities as described below.

Contents Previous Next