JpGraph サンプル

← 一覧に戻る
<?php // content="text/plain; charset=utf-8"
// $Id: piecex2.php,v 2003/08/19 20:40:12 aditus Exp $
// Example of pie with center circle
require_once ("jpgraph/jpgraph.php");
require_once ("jpgraph/jpgraph_pie.php");

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

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

// Don't display the border

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

// Setup title
$graph->title->SetMargin(8); // Add a little bit more margin from the top

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

// Set size of pie

// 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

// Add plot to pie graph

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


← 一覧に戻る