本文整理汇总了PHP中PiePlot::SetGuideLines方法的典型用法代码示例。如果您正苦于以下问题:PHP PiePlot::SetGuideLines方法的具体用法?PHP PiePlot::SetGuideLines怎么用?PHP PiePlot::SetGuideLines使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PiePlot
的用法示例。
在下文中一共展示了PiePlot::SetGuideLines方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
// content="text/plain; charset=utf-8"
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_pie.php';
$data = array(19, 12, 4, 3, 3, 12, 3, 3, 5, 6, 7, 8, 8, 1, 7, 2, 2, 4, 6, 8, 21, 23, 2, 2, 12);
// Create the Pie Graph.
$graph = new PieGraph(300, 350);
// Set A title for the plot
$graph->title->Set("Label guide lines");
$graph->title->SetFont(FF_VERDANA, FS_BOLD, 12);
$graph->title->SetColor("darkblue");
$graph->legend->Pos(0.1, 0.2);
// Create pie plot
$p1 = new PiePlot($data);
$p1->SetCenter(0.5, 0.55);
$p1->SetSize(0.3);
// Enable and set policy for guide-lines
$p1->SetGuideLines();
$p1->SetGuideLinesAdjust(1.4);
// Setup the labels
$p1->SetLabelType(PIE_VALUE_PER);
$p1->value->Show();
$p1->value->SetFont(FF_ARIAL, FS_NORMAL, 9);
$p1->value->SetFormat('%2.1f%%');
// Add and stroke
$graph->Add($p1);
$graph->Stroke();
?>
示例2: array
// content="text/plain; charset=utf-8"
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_pie.php';
$data = array(19, 12, 4, 3, 3, 12, 3, 3, 5, 6, 7, 8, 8, 1, 7, 2, 2, 4, 6, 8, 21, 23, 2, 2, 12);
// Create the Pie Graph.
$graph = new PieGraph(300, 350);
// Set A title for the plot
$graph->title->Set("Label guide lines");
$graph->title->SetFont(FF_VERDANA, FS_BOLD, 12);
$graph->title->SetColor("darkblue");
$graph->legend->Pos(0.1, 0.2);
// Create pie plot
$p1 = new PiePlot($data);
$p1->SetCenter(0.5, 0.55);
$p1->SetSize(0.3);
// Enable and set policy for guide-lines. Make labels line up vertically
// and force guide lines to always beeing used
$p1->SetGuideLines(true, false, true);
$p1->SetGuideLinesAdjust(1.5);
// Setup the labels
$p1->SetLabelType(PIE_VALUE_PER);
$p1->value->Show();
$p1->value->SetFont(FF_ARIAL, FS_NORMAL, 9);
$p1->value->SetFormat('%2.1f%%');
// Add and stroke
$graph->Add($p1);
$graph->Stroke();
?>
示例3: _renderPieChart
private function _renderPieChart($groupCount, $dimensions = '2d', $doughnut = False, $multiplePlots = False)
{
require_once 'jpgraph_pie.php';
if ($dimensions == '3d') {
require_once 'jpgraph_pie3d.php';
}
$this->_renderPiePlotArea($doughnut);
$iLimit = $multiplePlots ? $groupCount : 1;
for ($groupID = 0; $groupID < $iLimit; ++$groupID) {
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
$exploded = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
if ($groupID == 0) {
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
if ($labelCount > 0) {
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount);
}
}
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array();
// For pie charts, we only display the first series: doughnut charts generally display all series
$jLimit = $multiplePlots ? $seriesCount : 1;
// Loop through each data series in turn
for ($j = 0; $j < $jLimit; ++$j) {
$dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
// Fill in any missing values in the $dataValues array
$testCurrentIndex = 0;
foreach ($dataValues as $k => $dataValue) {
while ($k != $testCurrentIndex) {
$dataValues[$testCurrentIndex] = null;
++$testCurrentIndex;
}
++$testCurrentIndex;
}
if ($dimensions == '3d') {
$seriesPlot = new PiePlot3D($dataValues);
} else {
if ($doughnut) {
$seriesPlot = new PiePlotC($dataValues);
} else {
$seriesPlot = new PiePlot($dataValues);
}
}
if ($multiplePlots) {
$seriesPlot->SetSize(($jLimit - $j) / ($jLimit * 4));
}
if ($doughnut) {
$seriesPlot->SetMidColor('white');
}
$seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]);
if (count($datasetLabels) > 0) {
$seriesPlot->SetLabels(array_fill(0, count($datasetLabels), ''));
}
if ($dimensions != '3d') {
$seriesPlot->SetGuideLines(false);
}
if ($j == 0) {
if ($exploded) {
$seriesPlot->ExplodeAll();
}
$seriesPlot->SetLegends($datasetLabels);
}
$this->_graph->Add($seriesPlot);
}
}
}
示例4: 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();
}
示例5: print_graph
//.........这里部分代码省略.........
$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);
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");
}
} else {
$p1->value->Show(false);
示例6: 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();
*/
}
示例7: create_graph
public function create_graph($width = 600, $height = 200, $data, $title, $xaxis, $yaxis, $type = "bar")
{
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_line.php';
require_once 'jpgraph/jpgraph_bar.php';
require_once 'jpgraph/jpgraph_pie.php';
// Create a graph instance
if ($type == "bar" || $type == "line") {
$graph = new Graph($width, $height);
} else {
if ($type == "pie") {
$graph = new PieGraph($width, $height);
}
}
// Specify what scale we want to use,
// int = integer scale for the X-axis
// int = integer scale for the Y-axis
$graph->SetScale('intint');
$graph->SetMarginColor("lightblue:1.1");
$graph->SetShadow();
$graph->SetMargin(60, 20, 10, 40);
// Box around plotarea
$graph->SetBox();
// No frame around the image
$graph->SetFrame(false);
// Setup a title for the graph
$graph->title->Set($title);
$graph->title->SetMargin(8);
$graph->title->SetColor("darkred");
// Setup the X and Y grid
$graph->ygrid->SetFill(true, '#DDDDDD@0.5', '#BBBBBB@0.5');
$graph->ygrid->SetLineStyle('dashed');
$graph->ygrid->SetColor('gray');
$graph->xgrid->Show();
$graph->xgrid->SetLineStyle('dashed');
$graph->xgrid->SetColor('gray');
// Setup titles and X-axis labels, if it's array, first row is title
if (is_array($xaxis)) {
$graph->xaxis->title->Set($xaxis[0]);
$xaxis = array_slice($xaxis, 1, count($xaxis) - 1);
$graph->xaxis->SetTickLabels($xaxis);
} else {
$graph->xaxis->title->Set($xaxis);
}
// no array, just show name
// Setup Y-axis title
$graph->yaxis->title->SetMargin(10);
$graph->yaxis->title->Set($yaxis);
if ($type == "bar") {
$plot = new BarPlot($data);
$plot->SetWidth(0.6);
$fcol = '#440000';
$tcol = '#FF9090';
$plot->SetFillGradient("navy:0.9", "navy:1.85", GRAD_LEFT_REFLECTION);
//$plot->SetColor("black");
// Set line weigth to 0 so that there are no border
// around each bar
$plot->SetWeight(0);
// Add the plot to the graph
$graph->Add($plot);
} else {
if ($type == "line") {
$plot = new LinePlot($data);
$plot->SetFillColor('skyblue@0.5');
$plot->SetColor('navy@0.7');
$plot->mark->SetType(MARK_SQUARE);
$plot->mark->SetColor('blue@0.5');
$plot->mark->SetFillColor('lightblue');
$plot->mark->SetSize(5);
// Add the plot to the graph
$graph->Add($plot);
} else {
if ($type == "pie") {
$plot = new PiePlot($data);
$plot->SetCenter(0.5, 0.55);
$plot->SetSize(0.2);
// Enable and set policy for guide-lines
$plot->SetGuideLines();
$plot->SetGuideLinesAdjust(1.4);
// Setup the labels
$plot->SetLabelType(PIE_VALUE_PER);
$plot->value->Show();
//$plot->value->SetFont(FF_ARIAL,FS_NORMAL,9);
$plot->value->SetFormat('%2.1f%%');
$plot->ExplodeSlice(1);
$plot->SetGuideLines(true);
$graph->SetMarginColor("white");
$plot->SetLegends($xaxis);
// Add the plot to the graph
$graph->Add($plot);
} else {
die($type . " is not known graph type");
}
}
}
// Display the graph
$fn = strtolower($title);
$fn = str_replace(" ", "", $fn);
$filename_relative = "site/web_app/images/dynamic/{$fn}.jpg";
$filename_full = __DIR__ . "/" . $filename_relative;
//.........这里部分代码省略.........
示例8: grafico_3_bd
public function grafico_3_bd()
{
require_once APPPATH . '/libraries/JpGraph/jpgraph_pie.php';
$data_circ = $this->id_asignacionprueba;
$columnas_circ = array('Correctas', 'Omitidas', 'Incorrectas');
$graph_circ = new PieGraph(500, 400);
$graph_circ->title->Set("Grafico 3 - circular o de pastel");
$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($this->id_asignacionprueba);
$graph_circ->legend->SetPos(0.2, 0.99, 'right', 'bottom');
$graph_circ->legend->SetFrameWeight(1);
$p1->SetGuideLines(true, false);
$p1->SetGuideLinesAdjust(1.5);
$p1->SetLabelType(PIE_VALUE_PER);
$p1->value->Show();
$graph_circ->Add($p1);
$graph_circ->Stroke(_IMG_HANDLER);
global $fileName_bd_3;
$this->fileName_bd_3 = "assets/images/grafica_muestra_bd_3.jpg";
$graph_circ->img->Stream($this->fileName_bd_3);
/*
$graph_circ->img->Headers();
$graph_circ->img->Stream();
*/
}