Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members Related Pages

## Examples and tests

This page shows some examples produced by the example application, gracetmpldemo, using several templates. In each image, you will find two frames: Left-hand-side the template, right-hand-side the result using that template. For variable expansion, a fallback value "`FAILED`" is used for evaluation purposes.

## Test01: basic data-type and legend-string test

In this test, two data types are demonstrated, i.e. data provided from the application and Literal-data which is provided by the template and goes literally to the output. Also, different ways of handling the legend string are shown.

The test is performed using a python script.

## Test02: copy-data and literal-data with variable expansion

In this test, the template contains two graphs, one of which is hidden from the applications and contains Copy-data sets and a Literal-data set. This so-called Protected graph contains a reference to a variable from another graph which tests for correct setup of the environment internals. This also applies for the variable references in the copy-data and literal-data sets.

Note the subtle difference between the two copy-data sets in magenta and red: The magenta one copies data from G1.S0 and uses the legend string the application sets for that dataset (which is the filename, transient.dat ), denoted by "`$`=" . The red copy-data set copies the same data, but uses the legend string provided by the template, as indicated by "$'". As the data points are the same for both the magenta and the red curve, you can only see the latter lying on top, actually.

The test also shows, that autoscaling can be turned off for certain axes (see lower graph) and that literal data is not used for autoscaling purposes (see blue data in upper graph).

The test is performed using the `gracetmpldemo` application.

## Test03: variable expansion and environments

This test shows how well variable expansion within the various environments works. The environments are:

- The sheet: The test application sets the variable `application` in the sheet's environment. This variable can be addressed from anywhere in the template (here only demonstrated with text objects). GraceTMPL itself sets the variables `pz` and `P` which are the current pagenumber and the number of pages, respectively. Text objects reside in the sheet's environment. All graphs on the page are children to the sheet, as far as environments are concerned.

- The graph: In each graph, the test application sets a variable `graph` which tells the name of the graph in the application. As shown with text objects and graph subtitles, the variable `graph` inside a graph can also be accessed from anywhere. Graph environments have the sheet as their surrounding environment and all contained sets as children (see below).

- The dataset: The test application sets a variable `what` in all datasets telling the name of that set. As always, these variables can be accessed from anywhere in the template, as shown with text objects and dataset legend strings.

Each of the environments can contain any number of variables - which of those are used in the template, is totally up to the template author. Also, if a variable is addresses from within the template that wasn't defined by the application, a fallback value can be used to print instead. Otherwise, nothing happens.

## Test04: multiple output pages

This test hows how GraceTMPL behaves when the application stores more graphs than the template defines. The output filename should then contain the pagenumber (i.e. `filename-$p.agr` ). GraceTMPL automatically outputs as many files as needed to store the requested graphs.

The pure horizontal and vertical data on pages 2 and 4 show how autoscale behaves, when the data has no true range in one dimension.