Chapter 30. Examples of applying a theme
| Part VII. Theme Class |

## Chapter 30. Examples of applying a theme

The following code is an example of using the theme class to customize some settings.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    <?php
    $data1y=array(47,80,40,116);
    $graph = new Graph(400, 300, 'auto');
    $graph->SetScale('textlin');

    $theme_class = new AquaTheme;
    $graph->SetTheme($theme_class);
    // after setting the theme, you can change individual details yourself
    $graph->SetFrame(true,'lightgray');                        // make frame visible and set color
    $graph->xaxis->SetTickLabels(array('A','B','C','D')); // change xaxis lagels
    $graph->title->Set("Theme Example");                    // add title

    // add barplot
    $bplot = new BarPlot($data1y);

    // you can change properties of the plot only after calling Add()
    $bplot->SetWeight(0);
    $bplot->SetFillGradient('#FFAAAA:0.7', '#FFAAAA:1.2', GRAD_VER);

    $graph->Stroke();
    ?>

The following graph was generated using this sample program.

Figure 30.1. Theme Sample `(`theme_example.php`)`

| Up |
| Home |