本文整理汇总了PHP中ezcGraphPieChart类的典型用法代码示例。如果您正苦于以下问题:PHP ezcGraphPieChart类的具体用法?PHP ezcGraphPieChart怎么用?PHP ezcGraphPieChart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ezcGraphPieChart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sourceGraph
private function sourceGraph()
{
$q = ezcDbInstance::get()->createSelectQuery();
$q->select('source, count(source)')->from('message')->groupBy('source');
$s = $q->prepare();
$s->execute();
$chart = new ezcGraphPieChart();
$chart->title = 'Sources';
$chart->legend = false;
$chart->palette = new ezcGraphPaletteEz();
$chart->data['browsers'] = new ezcGraphDatabaseDataSet($s);
$chart->render(300, 200, '/tmp/graph.png');
return file_get_contents('/tmp/graph.png');
}
示例2: testRenderPieChartWithGleamAndShadow
public function testRenderPieChartWithGleamAndShadow()
{
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$chart = new ezcGraphPieChart();
$chart->data['sample'] = new ezcGraphArrayDataSet(array('Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, 'wget' => 231, 'Safari' => 987));
$chart->data['sample']->highlight['Opera'] = true;
$chart->renderer->options->legendSymbolGleam = 0.5;
$chart->renderer->options->pieChartShadowSize = 5;
$chart->renderer->options->pieChartGleamBorder = 3;
$chart->renderer->options->pieChartGleam = 0.5;
$chart->driver = new ezcGraphSvgDriver();
$chart->render(500, 200, $filename);
$this->compare($filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg');
}
示例3: ezcGraphPieChart
<?php
require_once 'tutorial_autoload.php';
$graph = new ezcGraphPieChart();
$graph->title = 'Elections 2005 Germany';
$graph->data['2005'] = new ezcGraphArrayDataSet(array('CDU' => 35.2, 'SPD' => 34.2, 'FDP' => 9.800000000000001, 'Die Gruenen' => 8.1, 'PDS' => 8.699999999999999, 'NDP' => 1.6, 'REP' => 0.6));
$graph->options->label = '%3$.1f%%';
$graph->options->sum = 100;
$graph->options->percentThreshold = 0.02;
$graph->options->summarizeCaption = 'Others';
$graph->render(400, 150, 'tutorial_pie_options.svg');
示例4: __autoload
<?php
require 'Base/src/base.php';
function __autoload($className)
{
ezcBase::autoload($className);
}
// Require custom palette
require dirname(__FILE__) . '/ez_green.php';
// Create the graph
$graph = new ezcGraphPieChart();
$graph->palette = new ezcGraphPaletteEzGreen();
$graph->legend = false;
// Add the data and hilight norwegian data set
$graph->data['week'] = new ezcGraphArrayDataSet(array('Lukasz Serwatka' => 1805, 'Paul Forsyth' => 1491, 'Paul Borgermans' => 1316, 'Kristof Coomans' => 956, 'Alex Jones' => 942, 'Bard Farstad' => 941, 'Tony Wood' => 900));
// Set graph title
$graph->title = 'Alltime 10 most active users on forum';
// Use 3d renderer, and beautify it
$graph->renderer = new ezcGraphRenderer3d();
$graph->renderer->options->pieChartShadowSize = 12;
$graph->renderer->options->pieChartGleam = 0.5;
$graph->renderer->options->dataBorder = false;
$graph->renderer->options->pieChartHeight = 16;
$graph->renderer->options->legendSymbolGleam = 0.5;
$graph->renderer->options->pieChartOffset = 100;
$graph->driver = new ezcGraphSvgDriver();
// Output the graph with std SVG driver
$graph->render(500, 200, 'forum_year.svg');
示例5: ezcGraphPieChart
<?php
require_once 'tutorial_autoload.php';
$graph = new ezcGraphPieChart();
$graph->palette = new ezcGraphPaletteEzGreen();
$graph->title = 'Access statistics';
$graph->driver = new ezcGraphGdDriver();
$graph->options->font = 'tutorial_font.ttf';
$graph->data['Access statistics'] = new ezcGraphArrayDataSet(array('Mozilla' => 19113, 'Explorer' => 10917, 'Opera' => 1464, 'Safari' => 652, 'Konqueror' => 474));
$graph->data['Access statistics']->url = 'http://example.org/';
$graph->data['Access statistics']->url['Mozilla'] = 'http://example.org/mozilla';
$graph->render(400, 200, 'tutorial_reference_gd.png');
?>
<html>
<head><title>Image map example</title></head>
<body>
<?php
echo ezcGraphTools::createImageMap($graph, 'GraphPieChartMap');
?>
<img
src="tutorial_reference_gd.png"
width="400" height="200"
usemap="#GraphPieChartMap" />
</body>
</html>
示例6: printPieChart
/**
* Creates and prints the pie chart in the statistic
*
* @param String $type
*
* @static
*
*/
static function printPieChart($type = 'tech')
{
global $CFG_GLPI;
// Definition of Chart Labels
$label = array('tech' => __('Rating by the user', 'helpdeskrating'), 'user' => __('Rating by the technician', 'helpdeskrating'));
$uid = PluginHelpdeskratingStatistic::getUserID();
if ($uid) {
// Get Graph Data
$data = PluginHelpdeskratingStatistic::getSpreadingData($type);
if ($data[__('in progress', 'helpdeskrating')] == 0 && $data[__('closed', 'helpdeskrating')] == 0 && $data[__('rated', 'helpdeskrating')] == 0) {
echo "<h1>{$label[$type]}</h1>";
echo __('no data available', 'helpdeskrating');
} else {
// Create Graph
$graph = new ezcGraphPieChart();
$graph->title = $label[$type];
// Set Graph Data
$graph->data['data'] = new ezcGraphArrayDataSet($data);
// Graph Legend
$graph->legend->position = ezcGraph::BOTTOM;
$graph->data['data']->color[__('in progress', 'helpdeskrating')] = '#55575388';
$graph->data['data']->highlight[__('in progress', 'helpdeskrating')] = true;
$graph->data['data']->color[__('closed', 'helpdeskrating')] = '#F5900080';
$graph->data['data']->color[__('rated', 'helpdeskrating')] = '#4E9A0680';
// Graph Output
$filename = $uid . '_' . mt_rand() . '.svg';
$graph->render(400, 300, GLPI_GRAPH_DIR . '/' . $filename);
echo "<object data='" . $CFG_GLPI['root_doc'] . "/front/graph.send.php?file={$filename}'\n type='image/svg+xml' width='400' height='300'>\n <param name='src' value='" . $CFG_GLPI['root_doc'] . "/front/graph.send.php?file={$filename}'>\n You need a browser capeable of SVG to display this image.\n </object> ";
}
}
}
示例7: graph_pie
function graph_pie($p_metrics, $p_title = '', $p_graph_width = 500, $p_graph_height = 350, $p_center = 0.4, $p_poshorizontal = 0.1, $p_posvertical = 0.09)
{
$t_graph_font = graph_get_font();
error_check(is_array($p_metrics) ? array_sum($p_metrics) : 0, $p_title);
if (plugin_config_get('eczlibrary') == ON) {
$graph = new ezcGraphPieChart();
$graph->title = $p_title;
$graph->background->color = '#FFFFFF';
$graph->options->font = $t_graph_font;
$graph->options->font->maxFontSize = 12;
$graph->legend = false;
$graph->data[0] = new ezcGraphArrayDataSet($p_metrics);
$graph->data[0]->color = '#FFFF00';
$graph->renderer = new ezcGraphRenderer3d();
$graph->renderer->options->dataBorder = false;
$graph->renderer->options->pieChartShadowSize = 10;
$graph->renderer->options->pieChartGleam = 0.5;
$graph->renderer->options->pieChartHeight = 16;
$graph->renderer->options->legendSymbolGleam = 0.5;
$graph->driver = new ezcGraphGdDriver();
//$graph->driver->options->supersampling = 1;
$graph->driver->options->jpegQuality = 100;
$graph->driver->options->imageFormat = IMG_JPEG;
$graph->renderer->options->syncAxisFonts = false;
$graph->renderToOutput($p_graph_width, $p_graph_height);
} else {
$graph = new PieGraph($p_graph_width, $p_graph_height);
$graph->img->SetMargin(40, 40, 40, 100);
$graph->title->Set($p_title);
$graph->title->SetFont($t_graph_font, FS_BOLD);
$graph->SetMarginColor('white');
$graph->SetFrame(false);
$graph->legend->Pos($p_poshorizontal, $p_posvertical);
$graph->legend->SetFont($t_graph_font);
$p1 = new PiePlot3d(array_values($p_metrics));
// should be reversed?
$p1->SetTheme('earth');
# $p1->SetTheme("sand");
$p1->SetCenter($p_center);
$p1->SetAngle(60);
$p1->SetLegends(array_keys($p_metrics));
# Label format
$p1->value->SetFormat('%2.0f');
$p1->value->Show();
$p1->value->SetFont($t_graph_font);
$graph->Add($p1);
if (helper_show_query_count()) {
$graph->subtitle->Set(db_count_queries() . ' queries (' . db_time_queries() . 'sec)');
$graph->subtitle->SetFont($t_graph_font, FS_NORMAL, 8);
}
$graph->Stroke();
}
}
示例8: testSvgWithDifferentLocales
public function testSvgWithDifferentLocales()
{
$this->setLocale(LC_NUMERIC, 'de_DE', 'de_DE.UTF-8', 'de_DE.UTF8', 'deu_deu', 'de', 'ge', 'deutsch', 'de_DE@euro');
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$chart = new ezcGraphPieChart();
$chart->palette = new ezcGraphPaletteEz();
$chart->options->font = $this->basePath . 'font.svg';
$chart->data['sample'] = new ezcGraphArrayDataSet(array('Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, 'wget' => 231, 'Safari' => 987));
$chart->data['sample']->highlight['Safari'] = true;
$chart->renderer = new ezcGraphRenderer3d();
$chart->renderer->options->pieChartShadowSize = 10;
$chart->renderer->options->pieChartGleam = 0.5;
$chart->renderer->options->dataBorder = false;
$chart->renderer->options->pieChartHeight = 16;
$chart->renderer->options->legendSymbolGleam = 0.5;
$chart->render(500, 200, $filename);
$this->compare($filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg');
}
示例9: testRenderLabeledFlashPieChart
public function testRenderLabeledFlashPieChart()
{
$filename = $this->tempDir . __FUNCTION__ . '.swf';
$chart = new ezcGraphPieChart();
$chart->options->font->path = dirname(__FILE__) . '/data/fdb_font.fdb';
$chart->palette = new ezcGraphPaletteEz();
$chart->data['sample'] = new ezcGraphArrayDataSet(array('Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, 'wget' => 231, 'Safari' => 987));
$chart->data['sample']->highlight['Safari'] = true;
$chart->renderer = new ezcGraphRenderer3d();
$chart->renderer->options->pieChartShadowSize = 10;
$chart->renderer->options->pieChartGleam = 0.5;
$chart->renderer->options->dataBorder = false;
$chart->renderer->options->pieChartHeight = 16;
$chart->renderer->options->legendSymbolGleam = 0.5;
$chart->driver = new ezcGraphFlashDriver();
$chart->render(500, 200, $filename);
$this->swfCompare($filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.swf');
}
示例10: testPieChartWithoutData
public function testPieChartWithoutData()
{
try {
$pieChart = new ezcGraphPieChart();
$pieChart->render(400, 200);
} catch (ezcGraphNoDataException $e) {
return true;
}
$this->fail('Expected ezcGraphNoDataException.');
}
示例11: testBottomLegend
public function testBottomLegend()
{
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$chart = new ezcGraphPieChart();
$chart->data['sample'] = new ezcGraphArrayDataSet(array('Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, 'wget' => 231, 'Safari' => 987));
$chart->legend->position = ezcGraph::BOTTOM;
$chart->legend->padding = 2;
$chart->render(500, 200, $filename);
$this->compare($filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg');
}
示例12: ezcGraphPieChart
<?php
require_once 'tutorial_autoload.php';
$graph = new ezcGraphPieChart();
$graph->title = 'Access statistics';
$graph->data['Access statistics'] = new ezcGraphArrayDataSet(array('Mozilla' => 19113, 'Explorer' => 10917, 'Opera' => 1464, 'Safari' => 652, 'Konqueror' => 474));
$graph->data['Access statistics']->highlight['Opera'] = true;
$graph->render(400, 150, 'tutorial_simple_pie.svg');
示例13: ezcGraphPieChart
<?php
require_once 'tutorial_autoload.php';
$graph = new ezcGraphPieChart();
$graph->palette = new ezcGraphPaletteEzBlue();
$graph->title = 'Access statistics';
$graph->options->font->name = 'serif';
$graph->title->background = '#EEEEEC';
$graph->title->font->name = 'sans-serif';
$graph->options->font->maxFontSize = 8;
$graph->data['Access statistics'] = new ezcGraphArrayDataSet(array('Mozilla' => 19113, 'Explorer' => 10917, 'Opera' => 1464, 'Safari' => 652, 'Konqueror' => 474));
$graph->render(400, 150, 'tutorial_chart_title.svg');
示例14: ezcGraphPieChart
<?php
/* -*- mode: php; c-basic-offset: 4; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=4:tabstop=4:
*/
$graph = new ezcGraphPieChart();
$graph->palette = new ezcGraphPaletteEzBlue();
$graph->legend = false;
$graph->data['File number per ' . $index] = new ezcGraphArrayDataSet($count);
$graph->data['File number per ' . $index]->highlight['Others'] = true;
$graph->renderer = new ezcGraphRenderer3d();
$graph->renderer->options->moveOut = 0.2;
$graph->renderer->options->pieChartOffset = 63;
$graph->renderer->options->pieChartGleam = 0.3;
$graph->renderer->options->pieChartGleamColor = '#FFFFFF';
$graph->renderer->options->pieChartGleamBorder = 2;
$graph->renderer->options->pieChartShadowSize = 5;
$graph->renderer->options->pieChartShadowColor = '#BABDB6';
$graph->renderer->options->pieChartHeight = 5;
$graph->renderer->options->pieChartRotation = 0.8;
$graph->driver = new ezcGraphGdDriver();
$graph->options->font = 'app/img/arial.ttf';
$graph->driver->options->imageFormat = IMG_PNG;
$graph->render(532, 195, 'app/img/graph/countPieGraph.png');
echo '<h2>File number per ' . $index . '</h2>';
?>
<img src="app/img/graph/countPieGraph.png"/>
<table class="simple">
<thead>
<tr>
示例15: ezcGraphPieChart
<?php
require_once 'tutorial_autoload.php';
$graph = new ezcGraphPieChart();
$graph->palette = new ezcGraphPaletteEzRed();
$graph->title = 'Access statistics';
$graph->options->label = '%2$d (%3$.1f%%)';
$graph->data['Access statistics'] = new ezcGraphArrayDataSet(array('Mozilla' => 19113, 'Explorer' => 10917, 'Opera' => 1464, 'Safari' => 652, 'Konqueror' => 474));
$graph->data['Access statistics']->highlight['Explorer'] = true;
$graph->renderer = new ezcGraphRenderer3d();
$graph->renderer->options->moveOut = 0.2;
$graph->renderer->options->pieChartOffset = 63;
$graph->renderer->options->pieChartGleam = 0.3;
$graph->renderer->options->pieChartGleamColor = '#FFFFFF';
$graph->renderer->options->pieChartShadowSize = 5;
$graph->renderer->options->pieChartShadowColor = '#000000';
$graph->renderer->options->legendSymbolGleam = 0.5;
$graph->renderer->options->legendSymbolGleamSize = 0.9;
$graph->renderer->options->legendSymbolGleamColor = '#FFFFFF';
$graph->renderer->options->pieChartSymbolColor = '#55575388';
$graph->renderer->options->pieChartHeight = 5;
$graph->renderer->options->pieChartRotation = 0.8;
$graph->render(400, 150, 'tutorial_pie_chart_3d.svg');