| [42] | 1 | <?php // content="text/plain; charset=utf-8"
|
|---|
| 2 | require_once ('jpgraph/jpgraph.php');
|
|---|
| 3 | require_once ('jpgraph/jpgraph_pie.php');
|
|---|
| 4 |
|
|---|
| 5 | // Some data
|
|---|
| 6 | $data = array(40,21,17,14,23);
|
|---|
| 7 |
|
|---|
| 8 | // Create the Pie Graph.
|
|---|
| 9 | $graph = new PieGraph(350,300);
|
|---|
| 10 | $graph->SetShadow();
|
|---|
| 11 |
|
|---|
| 12 | // Set A title for the plot
|
|---|
| 13 | $graph->title->Set("Multiple - Pie plot");
|
|---|
| 14 | $graph->title->SetFont(FF_FONT1,FS_BOLD);
|
|---|
| 15 |
|
|---|
| 16 | // Create plots
|
|---|
| 17 | $size=0.13;
|
|---|
| 18 | $p1 = new PiePlot($data);
|
|---|
| 19 | $p1->SetLegends(array("Jan","Feb","Mar","Apr","May"));
|
|---|
| 20 | $p1->SetSize($size);
|
|---|
| 21 | $p1->SetCenter(0.25,0.32);
|
|---|
| 22 | $p1->value->SetFont(FF_FONT0);
|
|---|
| 23 | $p1->title->Set("2001");
|
|---|
| 24 |
|
|---|
| 25 | $p2 = new PiePlot($data);
|
|---|
| 26 | $p2->SetSize($size);
|
|---|
| 27 | $p2->SetCenter(0.65,0.32);
|
|---|
| 28 | $p2->value->SetFont(FF_FONT0);
|
|---|
| 29 | $p2->title->Set("2002");
|
|---|
| 30 |
|
|---|
| 31 | $p3 = new PiePlot($data);
|
|---|
| 32 | $p3->SetSize($size);
|
|---|
| 33 | $p3->SetCenter(0.25,0.75);
|
|---|
| 34 | $p3->value->SetFont(FF_FONT0);
|
|---|
| 35 | $p3->title->Set("2003");
|
|---|
| 36 |
|
|---|
| 37 | $p4 = new PiePlot($data);
|
|---|
| 38 | $p4->SetSize($size);
|
|---|
| 39 | $p4->SetCenter(0.65,0.75);
|
|---|
| 40 | $p4->value->SetFont(FF_FONT0);
|
|---|
| 41 | $p4->title->Set("2004");
|
|---|
| 42 |
|
|---|
| 43 | $graph->Add($p1);
|
|---|
| 44 | $graph->Add($p2);
|
|---|
| 45 | $graph->Add($p3);
|
|---|
| 46 | $graph->Add($p4);
|
|---|
| 47 |
|
|---|
| 48 | $graph->Stroke();
|
|---|
| 49 |
|
|---|
| 50 | ?>
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|