Chapter 29. Attention

Table of Contents

29.1. The order of SetTheme() and changing settings
29.2. Changing the display settings of line/bar graphs

When using themes, there are some things that require particular attention.

The order of SetTheme() and changing settings

At first, $graph->SetTheme() should be used after creating the graph, just after $graph->SetScale(). The following code is an example.

1
2
3
4
$graph = new Graph(750, 320, 'auto');
$graph->SetScale('textlin');
$theme_class = new AquaTheme;
$graph->SetTheme($theme_class);

In this way, all the settings of AquaTheme(grid, background and font color etc) can be applied. Any plots after this will also use the AquaTheme settings. Of course there are times where we only want to change individual settings and not the overall theme. For example, there is no outline around the graph in 'AquaTheme'. To add an outline we can do the following. After SetTheme(), you can use functions to change individual settings. If you want to display an outline around the graph, add the following line to the code shown previously.

1
$graph->SetFrame(true);

In this way, all the settings of AquaTheme(grid, background and font color etc) can be applied. Any plots after this will also use the AquaTheme settings.