Chapter 28. Applying the prepared theme

To understand how themes are used, it is easiest to look at the sample code. For example, the Aqua Theme can be applied using the following.

1
2
3
4
<?php
$theme_class = new AquaTheme();
$graph->SetTheme($theme_class);
?>

In line 1, an instance of AquaTheme class is created, and the graph theme is changed by passing the instance to SetTheme(). To use 'GreenTheme' instead of 'AquaTheme', use the following.

1
$theme_class = new GreenTheme;

All theme classes inherit the abstract 'Theme' class.

Figure 28.1. Aqua Theme (aqua_example.php)

Aqua Theme (aqua_example.php)


Figure 28.2. Green Theme (green_example.php)

Green Theme (green_example.php)


Figure 28.3. Ocean Theme (ocean_example.php)

Ocean Theme (ocean_example.php)


Figure 28.4. Pastel Theme (pastel_example.php)

Pastel Theme (pastel_example.php)


Figure 28.5. Softy Theme (softy_example.php)

Softy Theme (softy_example.php)


Figure 28.6. Vivid Theme (vivid_example.php)

Vivid Theme (vivid_example.php)


Figure 28.7. Orange Theme (orange_example.php)

Orange Theme (orange_example.php)


Figure 28.8. Rose Theme (rose_example.php)

Rose Theme (rose_example.php)


Figure 28.9. Universal Theme (universal_example.php)

Universal Theme (universal_example.php)