Rev | Line | |
---|
[42] | 1 | <?php // content="text/plain; charset=utf-8"
|
---|
| 2 | require_once ('jpgraph/jpgraph.php');
|
---|
| 3 | require_once ('jpgraph/jpgraph_pie.php');
|
---|
| 4 |
|
---|
| 5 | $data = array(40,60,31,35);
|
---|
| 6 |
|
---|
| 7 | // A new pie graph
|
---|
| 8 | $graph = new PieGraph(250,200);
|
---|
| 9 | $graph->SetShadow();
|
---|
| 10 |
|
---|
| 11 | // Title setup
|
---|
| 12 | $graph->title->Set("Adjusting the label pos");
|
---|
| 13 | $graph->title->SetFont(FF_FONT1,FS_BOLD);
|
---|
| 14 |
|
---|
| 15 | // Setup the pie plot
|
---|
| 16 | $p1 = new PiePlot($data);
|
---|
| 17 |
|
---|
| 18 | // Adjust size and position of plot
|
---|
| 19 | $p1->SetSize(0.4);
|
---|
| 20 | $p1->SetCenter(0.5,0.52);
|
---|
| 21 |
|
---|
| 22 | // Setup slice labels and move them into the plot
|
---|
| 23 | $p1->value->SetFont(FF_FONT1,FS_BOLD);
|
---|
| 24 | $p1->value->SetColor("darkred");
|
---|
| 25 | $p1->SetLabelPos(0.6);
|
---|
| 26 |
|
---|
| 27 | // Finally add the plot
|
---|
| 28 | $graph->Add($p1);
|
---|
| 29 |
|
---|
| 30 | // ... and stroke it
|
---|
| 31 | $graph->Stroke();
|
---|
| 32 |
|
---|
| 33 | ?>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.