本文整理汇总了PHP中PieGraph::SetTheme方法的典型用法代码示例。如果您正苦于以下问题:PHP PieGraph::SetTheme方法的具体用法?PHP PieGraph::SetTheme怎么用?PHP PieGraph::SetTheme使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PieGraph
的用法示例。
在下文中一共展示了PieGraph::SetTheme方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createPie3D
function createPie3D($pValues = "")
{
// Some data
$values = array("2010" => 1950, "2011" => 750, "2012" => 2100, "2013" => 580, "2014" => 5000, "2015" => 5000, "2016" => 5000, "2017" => 5000);
if ($pValues) {
$values = $pValues;
}
$total = count($values);
$data = $total == 0 ? array(360) : array_values($values);
$keys = $total == 0 ? array("") : array_keys($values);
// Create the Pie Graph.
$graph = new PieGraph(380, 400);
$theme_class = new VividTheme();
$graph->SetTheme($theme_class);
// Set A title for the plot
//$graph->title->Set("A Simple 3D Pie Plot");
// Create
$p1 = new PiePlot3D($data);
$p1->SetLegends($keys);
$graph->Add($p1);
$p1->ShowBorder();
$p1->SetColor('black');
$p1->ExplodeSlice(1);
$graph->Stroke();
}
示例2: graficarTorta
function graficarTorta()
{
require 'jpgraph/src/jpgraph.php';
require 'jpgraph/src/jpgraph_pie.php';
require 'jpgraph/src/jpgraph_pie3d.php';
// Some data
$data = array($_GET['pos'], $_GET['neg']);
// Create the Pie Graph.
$graph = new PieGraph(350, 300);
$theme_class = new VividTheme();
$graph->SetTheme($theme_class);
// Set A title for the plot
// $graph->title->Set("Grafico Estadistico");
// Create
$p1 = new PiePlot3D($data);
$p1->ShowBorder();
$p1->SetColor('black');
$p1->ExplodeSlice(1);
$p1->SetLegends(array($_GET['lab1'], $_GET['lab2']));
$p1->SetCenter(0.5, 0.4);
$p1->SetAngle(40);
$graph->Add($p1);
$graph->Stroke();
}
示例3: array
<?php
// content="text/plain; charset=utf-8"
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_pie.php';
require_once 'jpgraph/jpgraph_pie3d.php';
// Some data
$data = array(40, 60, 21, 33);
// Create the Pie Graph.
$graph = new PieGraph(350, 250);
$theme_class = new UniversalTheme();
$graph->SetTheme($theme_class);
// Set A title for the plot
$graph->title->Set("A Simple 3D Pie Plot");
// Create
$p1 = new PiePlot3D($data);
$graph->Add($p1);
$p1->ShowBorder();
$p1->SetColor('black');
$p1->SetSliceColors(array('#1E90FF', '#2E8B57', '#ADFF2F', '#BA55D3'));
$p1->ExplodeSlice(1);
$graph->Stroke();
示例4: array
<?php
// content="text/plain; charset=utf-8"
require_once '../../vendor/autoload.php';
\JpGraph\JpGraph::load();
\JpGraph\JpGraph::module('pie');
\JpGraph\JpGraph::module('pie3d');
// Some data
$data = array(40, 60, 21, 33);
$piepos = array(0.2, 0.35, 0.5, 0.25, 0.3, 0.7, 0.85, 0.7);
$titles = array('USA', 'Sweden', 'South America', 'Australia');
$n = count($piepos) / 2;
// A new Graph\Graph
$graph = new \PieGraph(450, 300, 'auto');
$theme_class = "PastelTheme";
$graph->SetTheme(new $theme_class());
// Setup background
$graph->SetBackgroundImage('worldmap1.jpg', BGIMG_FILLFRAME);
// Setup title
$graph->title->Set("Pie plots with background image");
$graph->title->SetColor('white');
$graph->SetTitleBackground('#4169E1', TITLEBKG_STYLE2, TITLEBKG_FRAME_FULL, '#4169E1', 10, 10, true);
$p = array();
// Create the plots
for ($i = 0; $i < $n; ++$i) {
$p[] = new \PiePlot3D($data);
}
for ($i = 0; $i < $n; ++$i) {
$graph->Add($p[$i]);
}
// Position the four pies and change color
示例5: createPie
function createPie($waktu, $data_pie)
{
require_once '../jpgraph/jpgraph.php';
require_once '../jpgraph/jpgraph_pie.php';
require_once '../jpgraph/jpgraph_pie3d.php';
// Some data
$data = $data_pie;
// Create the Pie Graph.
$graph = new PieGraph(400, 300);
$theme_class = new VividTheme();
$graph->SetTheme($theme_class);
// Set A title for the plot
$graph->title->Set("GRAFIK KEPATUHAN WP");
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 12);
// Create
$p1 = new PiePlot3D($data);
$p1->SetLegends(array('PATUH', 'KURANG PATUH', 'TIDAK PATUH'));
$p1->SetCenter(0.5, 0.45);
$p1->ShowBorder();
$p1->SetColor('black');
$graph->Add($p1);
//unlink('../graphfiles/pie_kepatuhan.png');
$graph->Stroke("../graphfiles/pie_kepatuhan_" . $waktu . ".png");
}
示例6: piechartAction
/**
*
* @Route("/piechart/{qid}/{rid}/{style}", name="enquisa_piechart")
* @Method("GET")
*/
public function piechartAction(Request $request, $qid, $rid, $style)
{
/** @var $em Doctrine\ORM\EntityManager */
$em = $this->getDoctrine()->getManager();
//$total = $em->getRepository('EnquisaBundle:Enquisa')->getTotal();
//$qid = $request->query->get('qid');
if ($rid == 0) {
$preguntaStats = $em->getRepository('EnquisaBundle:Enquisa')->getPreguntaStats($qid);
} else {
$preguntaStats = $em->getRepository('EnquisaBundle:Enquisa')->getPreguntaStatsByRestaurant($qid, $rid);
}
if (count($preguntaStats) > 0) {
$data = [];
$label = [];
$title = '';
foreach ($preguntaStats as $pregunta) {
$title = $pregunta['texto'];
$data[] = $pregunta['value'];
$label[] = $pregunta['label'] . ' %.1f%%';
}
JpGraph::load();
JpGraph::module('pie');
JpGraph::module('pie3d');
$graph = new \PieGraph(350, 280);
if ($style == 'VividTheme') {
$theme_class = new \VividTheme();
} else {
$theme_class = new \UniversalTheme();
//\VividTheme;
}
$graph->SetTheme($theme_class);
$graph->legend->SetPos(0.5, 0.97, 'center', 'bottom');
$graph->legend->SetColumns(3);
$p1 = new \PiePlot3D($data);
$graph->Add($p1);
$p1->SetLegends($label);
$p1->ShowBorder();
$p1->SetColor('black');
$p1->SetLabelType(PIE_VALUE_PER);
$p1->SetSize(0.4);
$p1->SetCenter(0.5, 0.47);
$p1->value->Show();
$p1->value->SetFont(FF_ARIAL, FS_NORMAL, 12);
ob_start();
$graph->Stroke();
$imgStream = ob_get_contents();
ob_end_clean();
} else {
//gif transparent 1x1
$imgStream = base64_decode('R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7');
}
$response = new Response();
$response->headers->set('Cache-Control', 'private');
$response->headers->set('Content-type', 'image/png');
$response->setContent($imgStream);
return $response;
}