本文整理汇总了PHP中PiePlot::SetSliceColors方法的典型用法代码示例。如果您正苦于以下问题:PHP PiePlot::SetSliceColors方法的具体用法?PHP PiePlot::SetSliceColors怎么用?PHP PiePlot::SetSliceColors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PiePlot
的用法示例。
在下文中一共展示了PiePlot::SetSliceColors方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executePieGraph
public function executePieGraph()
{
//Set the response header to a image JPEG datastream
$this->getResponse()->setContent('image/jpeg');
$util = new util();
//echo $duales;
$data1 = $util->getDualMedia('movies');
$data2 = $util->getTotalMedia('movies') - $data1;
$data = array($data2, $data1);
$graph = new PieGraph(199, 120);
$graph->SetMarginColor('#393939');
$graph->SetFrame(true, '#393939');
$graph->legend->SetPos(0.8, 0.9, 'center', 'bottom');
$p1 = new PiePlot($data);
$p1->SetSize(0.4);
$p1->SetCenter(0.45);
$p1->SetSliceColors(array('white', 'red'));
$p1->value->SetColor('black');
$p1->SetLegends(array("Spa", "Dual"));
$p1->SetLabelPos(0.6);
$graph->Add($p1);
$graph->Stroke();
return sfView::NONE;
}
示例2: PieGraph
mysql_free_result($rsCSNF);
mysql_free_result($rsCSC);
/// A new pie graph
$graph = new PieGraph(400, 200, "auto");
$graph->SetScale('textint');
$logtype = tr("by_logtype");
// Title setup
$graph->title->Set($logtype);
$graph->title->SetFont(FF_ARIAL, FS_NORMAL);
//$graph ->legend->Pos( 0.25,0.8,"right" ,"bottom");
// Setup the pie plot
$p1 = new PiePlot($y);
$p1->SetTheme("earth");
$p1->value->SetFormat("%d");
$p1->SetLabelType(PIE_VALUE_ABS);
$p1->SetSliceColors(array('chartreuse3', 'chocolate2', 'wheat1'));
// Adjust size and position of plot
$p1->SetSize(0.35);
$p1->SetCenter(0.25, 0.52);
$f = tr("found");
$dnf = tr("not_found");
$com = tr("comment");
// Setup slice labels and move them into the plot
$xx = array($f, $dnf, $com);
$p1->value->SetFont(FF_COURIER, FS_NORMAL);
$p1->value->SetColor("black");
$p1->SetLabelPos(0.65);
$p1->SetLegends($xx);
$graph->legend->SetFont(FF_ARIAL, FS_NORMAL);
// Explode all slices
//$p1->ExplodeAll(10);
示例3: PieGraph
<?php
require '../include/core/common.php';
include '../include/jpgraph/jpgraph.php';
include '../include/jpgraph/jpgraph_pie.php';
unset($data);
for ($i = 1; $i <= SURVEY_MAX_ALTERNATIVES; $i++) {
if (isset($_GET['alt_' . $i])) {
$data[$i] = $_GET['alt_' . $i];
}
}
if (count($data) == 0 && is_numeric($_GET['poll_id'])) {
$poll = poll_fetch(array('id' => $_GET['poll_id']));
for ($i = 1; $i <= SURVEY_MAX_ALTERNATIVES; $i++) {
if (strlen($poll[0]['alt_' . $i]) > 0) {
$data[$i] = $poll[0]['alt_' . $i . '_votes'];
}
}
}
$graph = new PieGraph(190, 160);
$graph->SetAntiAliasing();
$graph->SetShadow();
$p1 = new PiePlot($data);
$p1->ShowBorder();
$graph->SetFrame(false, 'darkblue', 2);
$p1->SetSliceColors($survey_chart_colors);
$graph->Add($p1);
$graph->Stroke();
示例4: JpGraph
function JpGraph()
{
$graph = new PieGraph(230, 200, "auto");
//$graph->SetShadow();
// Set A title for the plot
$graph->title->Set($tpl->_ENGINE_parse_body("{your mailbox usage}\n ({$kb} mb free)"));
$graph->title->SetFont(FF_FONT1, FS_BOLD, 12);
$graph->title->SetColor("black");
$p1 = new PiePlot($data);
$p1->SetSliceColors(array("red", "green", "yellow", "green"));
$p1->SetTheme("water");
$p1->value->SetFont(FF_FONT1, FS_NORMAL, 10);
$p1->Explode(array(0, 15, 15, 25, 15));
//$p1->SetLabelType(PIE_VALUE_PER);
//$lbl = array("{used} $USER_STORAGE_USAGE","{free}");
//$p1->SetLabels($lbl);
$graph->Add($p1);
//$graph->img->SetAntiAliasing();
$graph->Stroke();
}
示例5: displayProjectProportionUsage
/**
*
* @param Integer $used
* @param Integer $total
*/
function displayProjectProportionUsage($used, $total)
{
$graph = new Chart_Pie(350, 250, "auto");
$data = array($used, $total - $used);
$usage = new PiePlot($data);
$usage->SetSliceColors(array('#44697D', '#ACBBA4'));
$usage->SetLegends(array("Used proportion", "Allowed quota"));
$graph->legend->SetPos(0.01, 0, 'right', 'top');
$graph->add($usage);
//graph display
$graph->stroke();
}
示例6: executePieGraphSingers
public function executePieGraphSingers(sfWebRequest $request)
{
$util = new util();
$loko = $util->singersData();
//Set the response header to a image JPEG datastream
$this->getResponse()->setContent('image/jpeg');
//echo $duales;
$data1 = 300;
$data2 = 200;
// $data_results = $util->singersData();
$data = array($data2, $data1);
$graph = new PieGraph(200, 174);
$graph->SetMarginColor('#393939');
$graph->SetFrame(true, '#393939');
$graph->legend->SetPos(0.8, 0.9, 'center', 'bottom');
$p1 = new PiePlot($data);
$p1->SetSize(0.4);
$p1->SetCenter(0.45);
$p1->SetSliceColors(array('white', 'red'));
$p1->value->SetColor('black');
$p1->SetLegends(array("Spa", "Dual"));
$p1->SetLabelPos(0.6);
$graph->Add($p1);
$graph->Stroke();
return sfView::NONE;
}
示例7: getColors
if (strlen($lastTLD)) {
getColors($colors, $count, $index);
}
// reset the counter
$count = 0;
$lastTLD = $tld;
}
$count++;
}
if (strlen($lastTLD)) {
getColors($colors, $count, $index);
}
$graph = new PieGraph($width, $height);
$graph->SetFrame(false);
$graph->SetAntiAliasing();
$pie = new PiePlot($values);
// set the actual labels for the wedges
$pie->SetLabels($labels, 1.1);
if (count($colors)) {
$pie->SetSliceColors($colors);
}
// set other options
$pie->SetGuideLines(true, true, true);
$graph->title->SetFont(FF_FONT2, FS_BOLD);
$graph->title->Set($chartType);
$pie->ShowBorder(true, true);
$pie->SetSize(0.25);
$graph->Add($pie);
$graph->img->SetExpired(false);
$graph->Stroke();
}
示例8: PieGraph
// Setup graph
$graph = new PieGraph(400, 400, "auto");
$graph->SetAntiAliasing();
$graph->SetMarginColor('#fafafa');
//$graph->SetShadow();
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Create pie plot
$p1 = new PiePlot($data);
//$p1->SetHeight(12);
$p1->SetSize(0.3);
if (count($labels) > 1) {
$p1->SetCenter(0.5, 0.5);
} else {
$p1->SetCenter(0.57, 0.3);
}
$p1->SetLabels($labels);
$p1->SetLabelPos(1);
if ($multiple_colors) {
$p1->SetLegends($legend);
$graph->legend->SetPos(0.5, 0.95, 'center', 'bottom');
$graph->legend->SetFrameWeight(0);
$graph->legend->SetFillColor('#fafafa');
$graph->legend->SetShadow(FALSE);
}
$graph->SetFrame(false);
$p1->SetSliceColors($colors);
//$p1->SetStartAngle(M_PI/8);
//$p1->ExplodeSlice(0);
$graph->Add($p1);
$graph->Stroke();
unset($graph);
示例9: print_graph
//.........这里部分代码省略.........
$xlangle = 50;
}
$xaxislblmargin = $pmb - 30;
$yaxislblmargin = $pml - 15;
if ($longestlabel && !$overlap) {
// if legend showing
$pmr = $longestlabel * 5 + 40;
}
$graph->legend->Pos(0.02, 0.1, 'right', 'top');
} else {
if ($type == 'horiz_bar') {
$pml = 50;
$pmr = 20;
$pmt = 50;
$pmb = 45;
$ll = $longestlegend * 6.5;
// 8pt fontsize
$pml = max($pml, $ll + 20);
$xaxislblmargin = $pml - 20;
$yaxislblmargin = $pmb - 15;
if ($longestlabel && !$overlap) {
// if legend showing
$pmr = $longestlabel * 5 + 40;
}
$graph->legend->Pos(0.02, 0.1, 'right', 'top');
}
}
}
}
}
// DRAW THE GRAPHS
if ($type == 'pie') {
$p1 = new PiePlot($data[0]);
$p1->SetSliceColors($colours);
if ($show_values) {
$p1->value->SetFont(FF_USERFONT, FS_NORMAL, 8 * $k);
if ($percent) {
$p1->SetLabelType(PIE_VALUE_PERADJ);
} else {
$p1->SetLabelType(PIE_VALUE_ABS);
}
if ($percent || $show_percent) {
$p1->value->SetFormat("%d%%");
} else {
$p1->value->SetFormat("%s");
}
// Enable and set policy for guide-lines. Make labels line up vertically
$p1->SetGuideLines(true);
$p1->SetGuideLinesAdjust(1.5);
} else {
$p1->value->Show(false);
}
$p1->SetLegends($legends);
$p1->SetSize($psize);
$p1->SetCenter($pposx, $pposy);
if ($labels[0]) {
$graph->subtitle->Set($labels[0]);
$graph->subtitle->SetMargin(10 * $k);
$graph->subtitle->SetFont(FF_USERFONT, FS_BOLD, 11 * $k);
$graph->subtitle->SetColor("black");
}
$graph->Add($p1);
} else {
if ($type == 'pie3d') {
$p1 = new PiePlot3d($data[0]);
$p1->SetSliceColors($colours);
示例10: PieGraph
}
}
$longest_size++;
for ($i = 0; $i < $category_count; $i++) {
#echo $data_count_arr[$i];
$percentage = number_format($data_count_arr[$i] / $total * 100, 1);
#echo $percentage;
$percentage_str = str_pad($percentage, 5, ' ', STR_PAD_LEFT);
$data_category_arr[$i] = str_pad($data_category_arr[$i], $longest_size);
$data_category_arr[$i] = $data_category_arr[$i] . $percentage_str;
if ($percentage < 1) {
$data_count_arr[$i] = 0;
}
}
$proj_name = project_get_field($t_project_id, 'name');
# Setup Graph
# ---
$graph = new PieGraph(800, 600);
$graph->SetShadow();
# Set A title for the plot
$graph->title->Set("Category Distribution Graph: {$proj_name}");
$graph->title->SetFont(FF_FONT2, FS_BOLD);
# Create graph
$p1 = new PiePlot($data_count_arr);
$p1->SetLegends($data_category_arr);
$p1->SetSize(260);
$p1->SetCenter(0.35);
$p1->SetSliceColors($g_color_arr);
$p1->SetStartAngle(-90);
$graph->Add($p1);
$graph->Stroke();
示例11: array
if (count($data) <= 0) {
$data = array(19, 12);
$labels = array("Male\n(%.1f%%)", "Female\n(%.1f%%)");
}
// Create the Pie Graph.
$graph = new PieGraph(200, 200);
//$graph->SetShadow();
// Set A title for the plot
$graph->title->Set('New Users by Gender');
$graph->title->SetFont(FF_VERDANA, FS_BOLD, 12);
$graph->title->SetColor('black');
// Create pie plot
$p1 = new PiePlot($data);
$p1->SetCenter(0.5, 0.5);
$p1->SetSize(0.3);
$p1->SetSliceColors(array('#1E90FF', '#2E8B57'));
// Setup the labels to be displayed
$p1->SetLabels($labels);
// This method adjust the position of the labels. This is given as fractions
// of the radius of the Pie. A value < 1 will put the center of the label
// inside the Pie and a value >= 1 will pout the center of the label outside the
// Pie. By default the label is positioned at 0.5, in the middle of each slice.
$p1->SetLabelPos(0.5);
// Setup the label formats and what value we want to be shown (The absolute)
// or the percentage.
$p1->SetLabelType(PIE_VALUE_PER);
$p1->value->Show();
$p1->value->SetFont(FF_ARIAL, FS_NORMAL, 9);
$p1->value->SetColor('white');
// Add and stroke
$graph->Add($p1);
示例12: PieGraph
$jpgraph = $conf->get_conf("jpgraph_path");
require_once "{$jpgraph}/jpgraph.php";
require_once "{$jpgraph}/jpgraph_pie.php";
// Setup graph
$graph = new PieGraph(400, 500, "auto");
$graph->SetAntiAliasing();
$graph->SetMarginColor('#fafafa');
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Create pie plot
$p1 = new PiePlot($data);
$p1->SetSize(0.3);
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.9, 'center', 'bottom');
$graph->legend->SetShadow(FALSE);
$graph->legend->SetFrameWeight(0);
$graph->legend->SetFillColor('#fafafa');
$graph->legend->SetColumns(3);
$graph->SetFrame(false);
$p1->SetSliceColors(Util::get_chart_colors());
//$p1->SetStartAngle(M_PI/8);
//$p1->ExplodeSlice(0);
$graph->Add($p1);
$graph->Stroke();
unset($graph);
示例13: grafico_distribucion_tipo_resp
public function grafico_distribucion_tipo_resp($id_asignacionprueba)
{
require_once APPPATH . '/libraries/JpGraph/jpgraph_pie.php';
$this->rendimiento_global($id_asignacionprueba);
$data_circ = array($this->totalcorrectas, $this->totalincorrectas, $this->totalomitidas);
$columnas_circ = array('Correctas', 'Incorrectas', 'Omitidas');
$graph_circ = new PieGraph(400, 320);
$graph_circ->title->Set("Distribución por Tipo de Respuesta");
$graph_circ->SetMarginColor("#fff");
$graph_circ->SetFrame(true, '#fff', 1);
$graph_circ->SetBox(false);
$p1 = new PiePlot($data_circ);
$p1->ExplodeSlice(0);
$p1->SetCenter(0.5);
//$p1->SetLegends('Correctas','Incorrectas','Omitidas');
$p1->SetLegends($columnas_circ);
// No border
$p1->ShowBorder(false);
$graph_circ->legend->SetPos(0.1, 0.996, 'left', 'bottom');
$graph_circ->legend->SetFrameWeight(1);
$p1->SetGuideLines(true, false);
$p1->SetGuideLinesAdjust(1.5);
$p1->SetLabelType(PIE_VALUE_PER);
$p1->value->Show();
$p1->SetSliceColors(array('#1d71b8', '#ea1d25', 'orange'));
$graph_circ->Add($p1);
$graph_circ->Stroke(_IMG_HANDLER);
global $img_graf_dist_resp;
$this->img_graf_dist_resp = "assets/images/graf_dist_resp.jpg";
$graph_circ->img->Stream($this->img_graf_dist_resp);
/*
$graph_circ->img->Headers();
$graph_circ->img->Stream();
*/
}
示例14: PieGraph
$skip_count = $request->get('s');
$total_count = $pass_count + $fail_count + $skip_count;
// graph size
$graph = new PieGraph(250, 150);
// graph title
$graph->title->Set($GLOBALS['Language']->getText('plugin_hudson', 'project_job_testresults'));
// graph legend
$pass_legend = $GLOBALS['Language']->getText('plugin_hudson', 'pass_legend', array($pass_count));
$fail_legend = $GLOBALS['Language']->getText('plugin_hudson', 'fail_legend', array($fail_count));
$skip_legend = $GLOBALS['Language']->getText('plugin_hudson', 'skip_legend', array($skip_count));
$array_legend = array($pass_legend, $fail_legend);
$array_value = array($pass_count, $fail_count);
$array_color = array('blue', 'red');
if ($skip_count != 0) {
$array_legend[] = $skip_legend;
$array_value[] = $skip_count;
$array_color[] = 'black';
}
// Init pie chart with graph values
$pp = new PiePlot($array_value);
// pie chart legend
$pp->SetLegends($array_legend);
// pie chart color values
// Pass is blue and Failed is red (Skip is black)
$pp->SetSliceColors($array_color);
// pie chart position
// the pie chart is a little bit on the left (0.35) and at the bottom (0.60)
$pp->SetCenter(0.35, 0.6);
$graph->Add($pp);
// display graph
$graph->Stroke();
示例15: array
if ($wins['mapstat_alien_wins'] + $wins['mapstat_human_wins'] + $wins['ties'] > 0) {
$data = array($wins['mapstat_alien_wins'], $wins['mapstat_human_wins'], $wins['ties']);
} else {
$data = array(0, 0, 1);
}
// Build graph
$g = new PieGraph(200, 120);
$g->SetMargin(30, 30, 10, 25);
$g->SetMarginColor('#22262a');
$g->SetColor('#22262a');
$g->SetFrame(true, array(0, 0, 0), 0);
$g->SetBox(false);
// Build plot
$p1 = new PiePlot($data);
$p1->SetCenter(40, 60);
$p1->SetSliceColors(array('#CC0000', '#0055FF', '#888888'));
$p1->value->show(false);
$legends = array('Aliens (%d%%)', 'Humans (%d%%)', 'Tied (%d%%)');
$p1->SetLegends($legends);
$g->legend->SetShadow(false);
$g->legend->SetAbsPos(10, 60, 'right', 'center');
// Stroke
$g->Add($p1);
$g->Stroke();
break;
case 'map_balance':
if (!isset($_GET['map_id'])) {
die('No map id given');
}
require_once 'core/jpgraph/jpgraph_bar.php';
// Get data