Chapter 13. Getting hold of the data to be displayed
| Part III. Common features |

## Chapter 13. Getting hold of the data to be displayed

The initial obstacle that must be negotiated is to get hold of the data to be displayed since the library itself is completely agnostic to where the data comes from. The library will use data supplied in one or more arrays and it is up to the user of the library to get hold of the data to populate these arrays with proper data. In principle the data can come from one of the following places

1. Hard-coded data in the script. This is the least flexible and can only really be recommended for examples and really static data.

2. Data stored in plain text files.

3. Data stored in binary format in flat files.

4. Data stored in a database

5. Data sent to the script via URI parameter passing (either GET or POST HTTP constructs can be used).

In the following sections we will shortly discuss each of these methods.

### Caution

The library assumes that the data available in an array that starts with index 0

## Static data

This is the simplest way and consists of only specifying the data in one or several usual PHP arrays directly in the graph script. For example to specify data for a Pieplot one could use the following constructions

    1
    2
    $data = array(1,8,5,4,12,18);
    $pieplot = new PiePlot ($data);

This is the method used for all examples under the "`Example/`" directory.

| Up |
| Home |