本文整理汇总了PHP中ezcGraphPieChart::render方法的典型用法代码示例。如果您正苦于以下问题:PHP ezcGraphPieChart::render方法的具体用法?PHP ezcGraphPieChart::render怎么用?PHP ezcGraphPieChart::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezcGraphPieChart
的用法示例。
在下文中一共展示了ezcGraphPieChart::render方法的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: generateBugStatusDistributionGraph
/**
* Generates a crash report version distribution graph for currently
* selected project and dumps it to stdout.
* @param type $w Desired image width.
* @param type $h Desired image height.
* @throws CHttpException
* @return void
*/
public static function generateBugStatusDistributionGraph($w, $h, $file = null)
{
if (!is_numeric($w) || $w <= 0 || $w > 1024) {
throw new CHttpException(403, 'Invalid parameter');
}
if (!is_numeric($h) || $h <= 0 || $h > 960) {
throw new CHttpException(403, 'Invalid parameter');
}
// Get current project info
$curProjectId = Yii::app()->user->getCurProjectId();
if ($curProjectId == false) {
throw new CHttpException(403, 'Invalid parameter');
}
$curVer = Yii::app()->user->getCurProjectVer();
// Prepare data
$criteria = new CDbCriteria();
$criteria->select = 'status, COUNT(*) as cnt';
$criteria->group = 'status';
$criteria->compare('project_id', $curProjectId);
$criteria->order = 'status DESC';
if ($curVer != -1) {
$criteria->compare('appversion_id', $curVer == 0 ? null : $curVer);
}
$data = array();
$models = Bug::model()->findAll($criteria);
$totalCount = 0;
$curVerStr = '';
foreach ($models as $model) {
$totalCount += $model->cnt;
$data[Lookup::item('BugStatus', $model->status)] = $model->cnt;
}
// Check the case when $data is empty.
if (count($data) == 0) {
// Open out file
if ($file != null) {
$fout = @fopen($file, 'w');
if ($fout == false) {
@unlink($tmpfile);
throw new CHttpException(403, 'Invalid file.');
}
}
// No data available
$fileName = Yii::app()->basePath . '/../images/no_data_available.png';
if ($fd = @fopen($fileName, "r")) {
$fsize = filesize($fileName);
// Write HTTP headers
header("Content-type: image/png");
//header("Content-Disposition: filename=\"".$fileName."\"");
header("Content-length: {$fsize}");
header("Cache-control: private");
//use this to open files directly
// Write file content
while (!feof($fd)) {
$buffer = fread($fd, 2048);
if ($file == null) {
echo $buffer;
} else {
fwrite($fout, $buffer);
}
}
if ($file != null) {
fclose($fout);
}
fclose($fd);
}
return;
}
$graph = new ezcGraphPieChart();
$graph->palette = new ezcGraphPaletteEzRed();
$graph->data['Versions'] = new ezcGraphArrayDataSet($data);
$graph->legend = true;
$graph->legend->position = ezcGraph::RIGHT;
$graph->options->font->name = 'Tahoma';
$graph->options->sum = $totalCount;
$graph->options->summarizeCaption = 'Others';
$graph->renderer->options->pieChartGleam = 0.3;
$graph->renderer->options->pieChartGleamColor = '#FFFFFF';
$graph->renderer->options->pieChartGleamBorder = 2;
$graph->renderer = new ezcGraphRenderer3d();
$graph->renderer->options->pieChartRotation = 0.8;
$graph->renderer->options->pieChartShadowSize = 10;
if ($file === null) {
$graph->renderToOutput($w, $h);
} else {
$graph->render($w, $h, $file);
}
}
示例3: ezcGraphPieChart
if (isset($user_status)) {
// build status chart
/*TODO Generalize pie chart generation*/
$graph = new ezcGraphPieChart();
$graph->palette = new ezcGraphPaletteEzBlue();
$graph->legend = false;
$title = 'Status repartition for user ' . $user . ' (count)';
$graph->data[$title] = new ezcGraphArrayDataSet($user_status);
$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/KhmerOSclassic.ttf';
$graph->driver->options->imageFormat = IMG_PNG;
// FIXME change png name depending on user
$graph->render(532, 195, 'app/img/graph/userStatusPieGraph-' . $user . '.png');
echo '<h2>' . $title . '</h2>';
echo '<img src="app/img/graph/userStatusPieGraph-' . $user . '.png"/>';
}
?>
示例4: __autoload
<?php
require 'Base/src/base.php';
function __autoload($className)
{
ezcBase::autoload($className);
}
// Require custom palette
require dirname(__FILE__) . '/ez_red.php';
// Create the graph
$graph = new ezcGraphPieChart();
$graph->palette = new ezcGraphPaletteEzRed();
$graph->legend = false;
// Add the data and hilight norwegian data set
$graph->data['week'] = new ezcGraphArrayDataSet(array('Claudia Kosny' => 128, 'Kristof Coomans' => 70, 'Xavier Dutoit' => 64, 'David Jones' => 58, 'Lukasz Serwatka' => 45, 'Norman Leutner' => 22, 'Marko Zmak' => 20, 'sangib das' => 20, 'Nabil Alimi' => 19));
// Set graph title
$graph->title = '10 most active users on forum in last month';
// 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_month.svg');
示例5: testRenderer3dPieChartMissingLabels
public function testRenderer3dPieChartMissingLabels()
{
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$chart = new ezcGraphPieChart();
$chart->data['TestCase'] = new ezcGraphArrayDataSet(array('Big' => 2.9, 'Small 1' => 0.03, 'Small 2' => 0.04, 'Small 3' => 0.03, 'Last' => 1));
$chart->renderer = new ezcGraphRenderer3d();
$chart->renderer->options->dataBorder = false;
$chart->render(500, 200, $filename);
$this->compare($filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg');
}
示例6: testRender3dPieChartWithOneDataPoint
public function testRender3dPieChartWithOneDataPoint()
{
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$chart = new ezcGraphPieChart();
$chart->data['Skien'] = new ezcGraphArrayDataSet(array('Norwegian' => 10));
$chart->renderer = new ezcGraphRenderer3d();
$chart->renderer->options->dataBorder = false;
$chart->render(500, 300, $filename);
$this->compare($filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg');
}
示例7: testPieChartSvgLinkingCustomCursor
public function testPieChartSvgLinkingCustomCursor()
{
$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']->url = 'http://example.org/browsers';
$chart->data['sample']->url['Mozilla'] = 'http://example.org/browsers/mozilla';
$chart->data['sample']->highlight['Opera'] = true;
$chart->driver->options->linkCursor = 'crosshair';
$chart->render(500, 200, $filename);
ezcGraphTools::linkSvgElements($chart);
$this->compare($filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg');
}
示例8: 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');
示例9: testPieChartWithoutData
public function testPieChartWithoutData()
{
try {
$pieChart = new ezcGraphPieChart();
$pieChart->render(400, 200);
} catch (ezcGraphNoDataException $e) {
return true;
}
$this->fail('Expected ezcGraphNoDataException.');
}
示例10: 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');
}
示例11: 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');
示例12: 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');
示例13: ucfirst
$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>
<th><?php
echo ucfirst($index);
?>
</th>
<th>Space used</th>
<th>Count</th>
</tr>
</thead>
示例14: ezcGraphPieChart
<?php
require_once 'tutorial_autoload.php';
$graph = new ezcGraphPieChart();
$graph->palette = new ezcGraphPaletteEzRed();
$graph->title = 'Access statistics';
$graph->data['Access statistics'] = new ezcGraphArrayDataSet(array('Mozilla' => 19113, 'Explorer' => 10917, 'Opera' => 1464, 'Safari' => 652, 'Konqueror' => 474));
$graph->background->image = 'ez.png';
$graph->background->position = ezcGraph::BOTTOM | ezcGraph::RIGHT;
$graph->background->repeat = ezcGraph::NO_REPEAT;
$graph->render(400, 150, 'tutorial_chart_background.svg');
示例15: testReturnFrom3dSvgPieChartWithGleam
public function testReturnFrom3dSvgPieChartWithGleam()
{
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$chart = new ezcGraphPieChart();
$chart->renderer = new ezcGraphRenderer3d();
$chart->renderer->options->pieChartGleam = 0.5;
$chart->data['sample'] = new ezcGraphArrayDataSet(array('Mozilla' => 4375, 'IE' => 345, 'Opera' => 1204, 'wget' => 231, 'Safari' => 987));
$chart->render(500, 200, $filename);
$reference = $chart->renderer->getElementReferences();
// Check data references
$this->assertSame(1, count($reference['data']), 'One dataset expected.');
$this->assertSame(5, count($reference['data']['sample']), '5 datapoints expected.');
$this->assertSame(3, count($reference['data']['sample']['Mozilla']), '2 elements for datapoint expexted');
$this->assertSame('ezcGraphCircleSector_45', $reference['data']['sample']['Mozilla'][0], 'ezcGraphCircleSector expected.');
$this->assertSame('ezcGraphCircleSector_46', $reference['data']['sample']['Mozilla'][1], 'ezcGraphCircleSector expected.');
$this->assertSame('ezcGraphTextBox_77', $reference['data']['sample']['Mozilla'][2], 'ezcGraphTextBox expected.');
// Check legend references
$this->assertSame(5, count($reference['legend']), '5 legend items expected.');
$this->assertSame(2, count($reference['legend']['IE']), '2 elements for legend item expected.');
$this->assertSame('ezcGraphPolygon_5', $reference['legend']['IE']['symbol'], 'ezcGraphPolygon expected as legend symbol.');
$this->assertSame('ezcGraphTextBox_6', $reference['legend']['IE']['text'], 'ezcGraphTextBox expected for legend text.');
// Check for legend URLs
$this->assertSame(5, count($reference['legend_url']), '5 legend url items expected.');
$this->assertSame(null, $reference['legend_url']['Mozilla'], 'No link expected for "moreData".');
}