5.9. Example - Pie Chart, text-data
Prev | Chapter 5. PHPlot Examples | Next

## 5.9. Example - Pie Chart, text-data

This is a simple pie chart showing the data type 'text-data'. When you use this data type with pie charts, the first entry in each record (a label) is ignored; the sum of all the second entries equals the relative size of the first slice, the sum of the third entries is the second slice, etc. So this pie has 4 slices, of relative size 250, 200, 350, and 200.

Data type 'data-data' is similar, except the first two entries in each record (label and X value for other plot types) is ignored.

Example 5.9. Pie Chart, text-data

    <?php
    # PHPlot Example: Pie/text-data
    require_once 'phplot.php';

    $data = array(
      array('', 100, 100, 200, 100),
      array('', 150, 100, 150, 100),
    );

    $plot = new PHPlot(800,600);
    $plot->SetImageBorderType('plain');
    $plot->SetDataType('text-data');
    $plot->SetDataValues($data);
    $plot->SetPlotType('pie');
    $plot->DrawGraph();

Prev | Up | Next
5.8. Example - Pie Chart, text-data-single | Home | 5.10. Example - Pie Chart, flat with options