本文整理汇总了PHP中PiePlot3d::ExplodeSlice方法的典型用法代码示例。如果您正苦于以下问题:PHP PiePlot3d::ExplodeSlice方法的具体用法?PHP PiePlot3d::ExplodeSlice怎么用?PHP PiePlot3d::ExplodeSlice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PiePlot3d
的用法示例。
在下文中一共展示了PiePlot3d::ExplodeSlice方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* @@生成三维饼图
* @param string $title
* @param array $data
* @param int $size
* @param int $height
* @param int $width
* @param array $legend
*/
static function create3dpie($title, $data = array(), $size = 40, $height = 100, $width = 80, $legend = array(), $slice = 0)
{
//包含相关的文件
vendor("Jpgraph.jpgraph");
vendor("Jpgraph.jpgraph_pie");
vendor("Jpgraph.jpgraph_pie3d");
// 创建图表
$graph = new PieGraph($width, $height, "auto");
$graph->SetShadow();
// 设置标题
$graph->title->Set(iconv("utf-8", "gb2312", $title));
//$graph->title->SetFont(FF_VERDANA,FS_BOLD,18);
$graph->title->SetFont(FF_SIMSUN, FS_BOLD, 18);
$graph->title->SetColor("darkblue");
$graph->legend->Pos(0.1, 0.2);
$graph->SetFrame(false, '#ffffff', 0);
//去掉周围的边框
// Create 3D pie plot
$p1 = new PiePlot3d($data);
$p1->SetTheme("sand");
$p1->SetCenter(0.4);
$p1->SetSize($size);
// Adjust projection angle
$p1->SetAngle(70);
// As a shortcut you can easily explode one numbered slice with
if ($slice == 0) {
$p1->ExplodeSlice(3);
}
// Setup the slice values
$p1->value->SetFont(FF_ARIAL, FS_BOLD, 10);
//$p1->value->SetFont(FF_SIMSUN,FS_BOLD,11);
$p1->value->SetColor("navy");
$graph->legend->SetFont(FF_SIMSUN, FS_BOLD, 8);
//编码转化
foreach ($legend as $k => $v) {
$legend[$k] = iconv('utf-8', 'gb2312', $v);
}
$p1->SetLegends($legend);
$graph->Add($p1);
$graph->Stroke();
}
示例2: CanvasGraph
function PIE_graph($module, $method, $type, $start, $extra_fields)
{
global $C_translate, $C_auth;
include_once PATH_CORE . 'validate.inc.php';
$dt = new CORE_validate();
include PATH_GRAPH . "jpgraph.php";
####################################################################
### Check if 'search' is authorized for this account
####################################################################
# check the validation for this function
if ($C_auth->auth_method_by_name($module, 'search')) {
# validate this file exists, and include it.
if (file_exists(PATH_MODULES . '/' . $module . '/' . $module . '.inc.php')) {
include_once PATH_MODULES . '/' . $module . '/' . $module . '.inc.php';
} else {
### Not exist!
$error = $C_translate->translate('module_non_existant', '', '');
}
} else {
### Not auth
$error = $C_translate->translate('module_non_auth', '', '');
}
if (isset($error)) {
include PATH_GRAPH . "jpgraph_canvas.php";
// Create the graph.
$graph = new CanvasGraph(460, 55, "auto");
$t1 = new Text($error);
$t1->Pos(0.2, 0.5);
$t1->SetOrientation("h");
$t1->SetBox("white", "black", 'gray');
$t1->SetFont(FF_FONT1, FS_NORMAL);
$t1->SetColor("black");
$graph->AddText($t1);
$graph->Stroke();
exit;
}
# initialize the module, if it has not already been initialized
$eval = '$' . $module . ' = new ' . $module . '; ';
$eval .= '$this_Obj = $' . $module . ';';
eval($eval);
# run the function
$array = call_user_func(array($module, $method), $start_str, $end_str, $constraint_array, $default_array, $extra_fields);
include PATH_GRAPH . "jpgraph_pie.php";
include PATH_GRAPH . "jpgraph_pie3d.php";
$data = $array['data'];
$legends = $array['legends'];
// Create the Pie Graph.
$graph = new PieGraph(500, 250, "auto");
$graph->SetScale("textlin");
$graph->SetMarginColor('#F9F9F9');
$graph->SetFrame(true, '#FFFFFF', 0);
$graph->SetColor('#F9F9F9');
// Create pie plot
$p1 = new PiePlot3d($data);
$p1->SetTheme("water");
$p1->SetCenter(0.4);
$p1->SetAngle(30);
$p1->value->SetFont(FF_FONT1, FS_NORMAL, 8);
$p1->SetLegends($legends);
// Explode the larges slice:
$largest = 0;
for ($i = 0; $i < count($data); $i++) {
if ($data[$i] > $largest) {
$largest = $data[$i];
$explode = $i;
}
}
if ($explode) {
$p1->ExplodeSlice($explode);
}
$graph->Add($p1);
$graph->Stroke();
}
示例3: array
include "../jpgraph_pie.php";
include "../jpgraph_pie3d.php";
// Some data
$data = array(20, 27, 45, 75, 90);
// Create the Pie Graph.
$graph = new PieGraph(350, 200, "auto");
$graph->SetShadow();
// Set A title for the plot
$graph->title->Set("Example 3 3D Pie plot");
$graph->title->SetFont(FF_VERDANA, FS_BOLD, 18);
$graph->title->SetColor("darkblue");
$graph->legend->Pos(0.1, 0.2);
// Create 3D pie plot
$p1 = new PiePlot3d($data);
$p1->SetTheme("sand");
$p1->SetCenter(0.4);
$p1->SetSize(80);
// Adjust projection angle
$p1->SetAngle(45);
// As a shortcut you can easily explode one numbered slice with
$p1->ExplodeSlice(3);
// Setup the slice values
$p1->value->SetFont(FF_ARIAL, FS_BOLD, 11);
$p1->value->SetColor("navy");
$p1->SetLegends(array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct"));
$graph->Add($p1);
$graph->Stroke();
?>
示例4: PieGraph
require_once "{$jpgraph}/jpgraph_pie.php";
require_once "{$jpgraph}/jpgraph_pie3d.php";
// Setup graph
$graph = new PieGraph(350, 420, "auto");
$graph->SetAntiAliasing();
$graph->SetMarginColor('#fafafa');
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Create pie plot
$p1 = new PiePlot3d($data);
$p1->SetHeight(12);
$p1->SetSize(0.5);
if (count($labels) > 1) {
$p1->SetCenter(0.5, 0.25);
} else {
$p1->SetCenter(0.57, 0.25);
}
$p1->SetLegends($legend);
$p1->SetLabels($labels);
$p1->SetLabelPos(1);
$graph->legend->SetPos(0.5, 0.95, 'center', 'bottom');
$graph->legend->SetShadow('#fafafa', 0);
$graph->legend->SetFrameWeight(1);
$graph->legend->SetFillColor('#fafafa');
$graph->legend->SetColumns(2);
$graph->SetFrame(false);
//$p1->SetSliceColors($colors);
//$p1->SetStartAngle(M_PI/8);
$p1->ExplodeSlice(0);
$graph->Add($p1);
$graph->Stroke();
unset($graph);