Location: PHPKode > projects > Monyet > plotter/jpgraph-2.2/src/Examples/piec_csimex1.php
// $Id: piec_csimex1.php,v 2003/10/09 21:05:39 aditus Exp $
// Example of pie with center circle
include ("../jpgraph.php");
include ("../jpgraph_pie.php");

// Some data
$data = array(50,28,25,27,31,20);

// A new pie graph
$graph = new PieGraph(400,400);

// If you don't want any  border just uncomment this line
// $graph->SetFrame(false);

// Uncomment this line to add a drop shadow to the border
// $graph->SetShadow();

// Setup title
$graph->title->Set("CSIM Center Pie plot ex 1");
$graph->title->SetMargin(8); // Add a little bit more margin from the top

// Create the pie plot
$p1 = new PiePlotC($data);

// Set the radius of pie (as fraction of image size)

// Move the center of the pie slightly to the top of the image

// Label font and color setup

// Setup the title on the center circle
$p1->midtitle->Set("Test mid\nRow 1\nRow 2");

// Set color for mid circle

// Use percentage values in the legends values (This is also the default)

// The label array values may have printf() formatting in them. The argument to the
// form,at string will be the value of the slice (either the percetage or absolute
// depending on what was specified in the SetLabelType() above.
$lbl = array("adam\n%.1f%%","bertil\n%.1f%%","johan\n%.1f%%",

// Uncomment this line to remove the borders around the slices
// $p1->ShowBorder(false);

// Add drop shadow to slices

// Explode all slices 15 pixels

// Setup the CSIM targets

// Setup a small help text in the image
$txt = new Text("Note: This is an example of image map. Hold\nyour mouse over the slices to see the values.\nThe URL just points back to this page");

// Add plot to pie graph

// .. and send the image on it's marry way to the browser


Return current item: Monyet