pieex3.php

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50

    <?php // content="text/plain; charset=utf-8"
    require_once ("jpgraph/jpgraph.php");
    require_once ("jpgraph/jpgraph_pie.php");

    // Some data
    $data = array(40,21,17,14,23);

    // Create the Pie Graph.
    $graph = new PieGraph(350,300);
    $graph->SetShadow();

    // Set A title for the plot
    $graph->title->Set("Multiple - Pie plot");
    $graph->title->SetFont(FF_FONT1,FS_BOLD);

    // Create plots
    $size=0.13;
    $p1 = new PiePlot($data);
    $p1->SetLegends(array("Jan","Feb","Mar","Apr","May"));
    $p1->SetSize($size);
    $p1->SetCenter(0.25,0.32);
    $p1->value->SetFont(FF_FONT0);
    $p1->title->Set("2001");

    $p2 = new PiePlot($data);
    $p2->SetSize($size);
    $p2->SetCenter(0.65,0.32);
    $p2->value->SetFont(FF_FONT0);
    $p2->title->Set("2002");

    $p3 = new PiePlot($data);
    $p3->SetSize($size);
    $p3->SetCenter(0.25,0.75);
    $p3->value->SetFont(FF_FONT0);
    $p3->title->Set("2003");

    $p4 = new PiePlot($data);
    $p4->SetSize($size);
    $p4->SetCenter(0.65,0.75);
    $p4->value->SetFont(FF_FONT0);
    $p4->title->Set("2004");

    $graph->Add($p1);
    $graph->Add($p2);
    $graph->Add($p3);
    $graph->Add($p4);

    $graph->Stroke();

    ?>