本文整理汇总了PHP中ezcGraphLineChart::render方法的典型用法代码示例。如果您正苦于以下问题:PHP ezcGraphLineChart::render方法的具体用法?PHP ezcGraphLineChart::render怎么用?PHP ezcGraphLineChart::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezcGraphLineChart
的用法示例。
在下文中一共展示了ezcGraphLineChart::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetFontForElementWithRendering
public function testSetFontForElementWithRendering()
{
$chart = new ezcGraphLineChart();
$chart->data['sampleData'] = new ezcGraphArrayDataSet(array('sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1));
$chart->options->font->path = $this->basePath . 'font.ttf';
$chart->legend->font->path = $this->basePath . 'font2.ttf';
$chart->render(500, 200);
$this->assertEquals($this->basePath . 'font.ttf', $chart->options->font->path, 'General font face should be the old one.');
$this->assertEquals($this->basePath . 'font.ttf', $chart->title->font->path, 'Font face for X axis should be the old one.');
$this->assertTrue($chart->legend->font instanceof ezcGraphFontOptions, 'No fontOptions object was created.');
$this->assertEquals($this->basePath . 'font2.ttf', $chart->legend->font->path, 'Font face for legend has not changed.');
}
示例2: testRenderTextTopMargin
public function testRenderTextTopMargin()
{
$chart = new ezcGraphLineChart();
$chart->data['sample'] = new ezcGraphArrayDataSet(array('foo' => 1, 'bar' => 10));
$chart->title = 'Title of a chart';
$chart->title->position = ezcGraph::TOP;
$chart->title->margin = 5;
$mockedRenderer = $this->getMock('ezcGraphRenderer2d', array('drawText'));
// Y-Axis
$mockedRenderer->expects($this->at(0))->method('drawText')->with($this->equalTo(new ezcGraphBoundings(6, 6, 494, 14)), $this->equalTo('Title of a chart'), $this->equalTo(ezcGraph::CENTER | ezcGraph::MIDDLE));
$chart->renderer = $mockedRenderer;
$chart->render(500, 200);
}
示例3: testRenderNoLabelRendererZeroAxisSpace
public function testRenderNoLabelRendererZeroAxisSpace()
{
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$chart = new ezcGraphLineChart();
$chart->additionalAxis['marker'] = $marker = new ezcGraphChartElementLabeledAxis();
$chart->additionalAxis['empty'] = $empty = new ezcGraphChartElementLabeledAxis();
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->xAxis->axisSpace = 0;
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->yAxis->axisSpace = 0;
$marker->position = ezcGraph::LEFT;
$marker->axisSpace = 0;
$marker->chartPosition = 1;
$empty->position = ezcGraph::RIGHT;
$empty->chartPosition = 0.0;
$empty->axisSpace = 0;
$empty->label = 'Marker';
$chart->data['moreData'] = new ezcGraphArrayDataSet(array('sample 1' => 112, 'sample 2' => 54, 'sample 3' => 12, 'sample 4' => -167, 'sample 5' => 329));
$chart->data['Even more data'] = new ezcGraphArrayDataSet(array('sample 1' => 300, 'sample 2' => -30, 'sample 3' => 220, 'sample 4' => 67, 'sample 5' => 450));
$chart->render(500, 200, $filename);
$this->compare($filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg');
}
示例4: generateBugStatusDynamicsGraph
//.........这里部分代码省略.........
}
if (!is_numeric($h) || $h <= 0 || $h > 960) {
throw new CHttpException(403, 'Invalid parameter');
}
if (!is_numeric($period) || $period <= 0 || $period > 365) {
throw new CHttpException(403, 'Invalid parameter');
}
// Get current project info
$curProjectId = Yii::app()->user->getCurProjectId();
$curVer = Yii::app()->user->getCurProjectVer();
// Prepare data
$dataAll = array();
$dataOpen = array();
$dataClosed = array();
$dataFixed = array();
$dataVerified = array();
$tomorrow = mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"));
$finishDate = $tomorrow - 1;
$curDate = $finishDate;
$dateFrom = $curDate;
while ($finishDate - $curDate < $period * 24 * 60 * 60) {
// Calc the beginning of time interval
if ($period > 30) {
$dateFrom = mktime(0, 0, 0, date("m", $curDate) - 1, date("d", $curDate), date("Y", $curDate));
} else {
if ($period > 7) {
$dateFrom = mktime(0, 0, 0, date("m", $curDate), date("d", $curDate) - 6, date("Y", $curDate));
} else {
$dateFrom = mktime(0, 0, 0, date("m", $curDate), date("d", $curDate), date("Y", $curDate));
}
}
// Get bug changes within the period
$criteria = new CDbCriteria();
$criteria->compare('bug.project_id', $curProjectId, false, 'AND');
if ($curVer != -1) {
$criteria->compare('bug.appversion_id', $curVer, false, 'AND');
}
$criteria->addCondition('t.status_change_id IS NOT NULL', 'AND');
$criteria->addCondition('t.timestamp <=' . $curDate, 'AND');
$criteria->addCondition('t.id IN (SELECT MAX({{bug_change}}.id) FROM {{bug_change}} GROUP BY {{bug_change}}.bug_id)', 'AND');
$criteria->with = array('bug', 'statuschange');
$bugChanges = BugChange::model()->findAll($criteria);
$countAll = 0;
$countOpen = 0;
$countClosed = 0;
$countFixed = 0;
$countVerified = 0;
foreach ($bugChanges as $bugChange) {
//print_r($bugChange->statuschange->status);
if ($bugChange->statuschange->status < Bug::STATUS_OPEN_MAX) {
$countOpen++;
} else {
if ($bugChange->statuschange->status > Bug::STATUS_OPEN_MAX) {
$countClosed++;
}
}
if ($bugChange->statuschange->status == Bug::STATUS_FIXED) {
$countFixed++;
}
if ($bugChange->statuschange->status == Bug::STATUS_VERIFIED) {
$countVerified++;
}
}
// Add an item to data
$key = $period > 30 ? date('M y', $curDate) : date('j M', $curDate);
$dataAll = array($key => $countOpen + $countClosed) + $dataAll;
$dataOpen = array($key => $countOpen) + $dataOpen;
$dataClosed = array($key => $countClosed) + $dataClosed;
$dataFixed = array($key => $countFixed) + $dataFixed;
$dataVerified = array($key => $countVerified) + $dataVerified;
// Next time interval
$curDate = $dateFrom - 1;
}
/*var_dump($dataAll);
var_dump($dataOpen);
var_dump($dataClosed);
var_dump($dataFixed);
var_dump($dataVerified);
return;*/
// Create graph
$graph = new ezcGraphLineChart();
$graph->palette = new ezcGraphPaletteEzBlue();
$graph->palette->dataSetColor = array('#0000FF', '#FF0000', '#00FF00', '#000000');
$graph->data['All'] = new ezcGraphArrayDataSet($dataAll);
$graph->data['Open'] = new ezcGraphArrayDataSet($dataOpen);
$graph->data['Fixed'] = new ezcGraphArrayDataSet($dataFixed);
$graph->data['Verified'] = new ezcGraphArrayDataSet($dataVerified);
$graph->yAxis->majorStep = 10;
$graph->yAxis->minorStep = 1;
$graph->xAxis->labelCount = 30;
$graph->options->fillLines = 210;
$graph->legend = true;
$graph->legend->position = ezcGraph::BOTTOM;
$graph->options->font->name = 'Tahoma';
if ($file === null) {
$graph->renderToOutput($w, $h);
} else {
$graph->render($w, $h, $file);
}
}
示例5: testRenderTextBoxesFromBottom
public function testRenderTextBoxesFromBottom()
{
$chart = new ezcGraphLineChart();
$chart->palette = new ezcGraphPaletteBlack();
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisBoxedLabelRenderer();
$chart->yAxis->position = ezcGraph::BOTTOM;
$chart->data['sampleData'] = new ezcGraphArrayDataSet(array('sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1));
$mockedRenderer = $this->getMock('ezcGraphRenderer2d', array('drawText'));
$mockedRenderer->expects($this->at(0))->method('drawText')->with($this->equalTo(new ezcGraphBoundings(102.0, 150.0, 138.0, 178.0), 1.0), $this->equalTo('0'), $this->equalTo(ezcGraph::MIDDLE | ezcGraph::RIGHT));
$mockedRenderer->expects($this->at(4))->method('drawText')->with($this->equalTo(new ezcGraphBoundings(102.0, 22.0, 138.0, 50.0), 1.0), $this->equalTo('400'), $this->equalTo(ezcGraph::MIDDLE | ezcGraph::RIGHT));
$chart->renderer = $mockedRenderer;
$chart->render(500, 200);
}
示例6: testStrToTimeLabelConvertionRendering
public function testStrToTimeLabelConvertionRendering()
{
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$chart = new ezcGraphLineChart();
$chart->data['some data'] = new ezcGraphArrayDataSet(array('1.1.2001' => 12, '1.1.2002' => 324, '1.1.2003' => 238, '1.1.2004' => 123));
$chart->data['some data']->symbol = ezcGraph::DIAMOND;
$chart->render(500, 200, $filename);
$this->compare($filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg');
}
示例7: ezcGraphLineChart
<?php
require_once 'tutorial_insert_data.php';
// Receive data from database
$db = ezcDbInstance::get();
$query = $db->createSelectQuery();
$query->select('hits')->from('browser_hits');
$statement = $query->prepare();
$statement->execute();
// Create chart from data
$chart = new ezcGraphLineChart();
$chart->title = 'Browser statistics';
$chart->options->fillLines = 220;
$chart->data['browsers'] = new ezcGraphDatabaseDataSet($statement);
$chart->data['average'] = new ezcGraphDataSetAveragePolynom($chart->data['browsers']);
$chart->render(400, 150, 'tutorial_single.svg');
示例8: printAxisChart
/**
* Creates and prints the Axis Chart
*
* @static
*
*/
static function printAxisChart($type = 'overall')
{
global $CFG_GLPI, $LANG;
// Definition of Graph Labels
$label = array('overall' => __('Overall satisfaction', 'helpdeskrating'), 'solution' => __('Satisfaction with the solution', 'helpdeskrating'), 'tech' => __('Satisfaction with the technician', 'helpdeskrating'), 'time' => __('Satisfaction with the chronological sequence', 'helpdeskrating'));
$uid = PluginHelpdeskratingStatistic::getUserID();
if ($uid) {
// Get Graph Data
$data = PluginHelpdeskratingStatistic::getTimedRatings($type);
if (empty($data)) {
echo "<h1>{$label[$type]}</h1>";
echo __('no data available', 'helpdeskrating');
} else {
// Create Graph
$graph = new ezcGraphLineChart();
$graph->title = $label[$type];
// Set Graph Data
foreach ($data as $key => $val) {
$graph->data[$key] = new ezcGraphArrayDataSet($val);
}
// Graph Display options
$graph->yAxis->min = 0;
$graph->yAxis->max = 6;
$graph->yAxis->majorStep = 1;
$graph->xAxis = new ezcGraphChartElementNumericAxis();
$graph->xAxis->min = 1;
$graph->xAxis->max = 12;
$graph->xAxis->majorStep = 1;
// Graph Output
$filename = $uid . '_' . mt_rand() . '.svg';
$graph->render(800, 300, GLPI_GRAPH_DIR . '/' . $filename);
echo "<object data='" . $CFG_GLPI['root_doc'] . "/front/graph.send.php?file={$filename}'\n type='image/svg+xml' width='800' 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> ";
// */
}
}
}
示例9: testReturnFrom3dSvgLineChart
public function testReturnFrom3dSvgLineChart()
{
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$chart = new ezcGraphLineChart();
$chart->palette = new ezcGraphPaletteBlack();
$chart->renderer = new ezcGraphRenderer3d();
$chart->data['sampleData'] = new ezcGraphArrayDataSet(array('sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1));
$chart->data['moreData'] = new ezcGraphArrayDataSet(array('sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1));
$chart->data['evenMoreData'] = new ezcGraphArrayDataSet(array('sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1));
$chart->data['sampleData']->url = 'http://example.com/';
$chart->render(500, 200, $filename);
$reference = $chart->renderer->getElementReferences();
// Check data references
$this->assertSame(3, count($reference['data']), '3 datasets expected.');
$this->assertSame(5, count($reference['data']['sampleData']), '5 datapoints expected.');
$this->assertSame(1, count($reference['data']['sampleData']['sample 2']), '1 element for datapoint expected.');
$this->assertSame('ezcGraphCircle_113', $reference['data']['sampleData']['sample 2'][0], 'ezcGraphCircle element expected.');
// Check legend references
$this->assertSame(3, count($reference['legend']), '3 legend items expected.');
$this->assertSame(2, count($reference['legend']['moreData']), '2 elements for legend item expected.');
$this->assertSame('ezcGraphCircle_6', $reference['legend']['moreData']['symbol'], 'ezcGraphCircle expected as legend symbol.');
$this->assertSame('ezcGraphTextBox_7', $reference['legend']['moreData']['text'], 'ezcGraphTextBox expected for legend text.');
// Check for legend URLs
$this->assertSame(3, count($reference['legend_url']), '3 legend url items expected.');
$this->assertSame(null, $reference['legend_url']['moreData'], 'No link expected for "moreData".');
$this->assertSame('http://example.com/', $reference['legend_url']['sampleData'], 'Link expected for "sampleData".');
}
示例10: testReRenderChart
public function testReRenderChart()
{
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$barChart = new ezcGraphLineChart();
$barChart->data['test'] = new ezcGraphArrayDataSet(array(5, 23, 42));
$color = $barChart->data['test']->color->default;
$barChart->render(400, 200, $filename);
$this->compare($filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg');
// Render a second time with a new dataset, and expect the same result
$barChart->data['test'] = new ezcGraphArrayDataSet(array(5, 23, 42));
$barChart->data['test']->color = $color;
$barChart->render(400, 200, $filename);
$this->compare($filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg');
}
示例11: testRotatedAxisLabel
public function testRotatedAxisLabel()
{
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$graph = new ezcGraphLineChart();
$graph->palette = new ezcGraphPaletteBlack();
$graph->data['sample1'] = new ezcGraphArrayDataSet(array(1, 4, 6, 8, 2));
$graph->data['sample1']->symbol = ezcGraph::SQUARE;
$graph->data['sample2'] = new ezcGraphArrayDataSet(array(4, 6, 8, 2, 1));
$graph->data['sample2']->symbol = ezcGraph::BOX;
$graph->xAxis->label = "Some axis label";
$graph->xAxis->labelRotation = 90;
$graph->render(560, 250, $filename);
$this->compare($filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg');
}
示例12: testShortAxis
public function testShortAxis()
{
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$graph = new ezcGraphLineChart();
$graph->palette = new ezcGraphPaletteBlack();
$graph->legend->position = ezcGraph::BOTTOM;
$graph->data['sample'] = new ezcGraphArrayDataSet(array(1, 4, 6, 8, 2));
$graph->renderer = new ezcGraphRenderer3d();
$graph->renderer->options->axisEndStyle = ezcGraph::NO_SYMBOL;
$graph->renderer->options->shortAxis = true;
$graph->render(560, 250, $filename);
$this->compare($filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg');
}
示例13: testRenderWithZeroAxisSpace
public function testRenderWithZeroAxisSpace()
{
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$labelCount = 20;
$data = $this->getRandomData($labelCount, 500, 2000, 23);
$chart = new ezcGraphLineChart();
$chart->palette = new ezcGraphPaletteBlack();
$chart->data['sample'] = new ezcGraphArrayDataSet($data);
// Set manual label count
$chart->xAxis->labelCount = 21;
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisRotatedLabelRenderer();
$chart->xAxis->axisLabelRenderer->angle = 45;
$chart->xAxis->axisSpace = 0.1;
$chart->yAxis->axisLabelRenderer = new ezcGraphAxisNoLabelRenderer();
$chart->yAxis->axisSpace = 0;
$chart->render(500, 200, $filename);
$this->compare($filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg');
}
示例14: ezcGraphLineChart
<?php
require 'ezc-setup.php';
header('Content-Type: image/svg+xml');
list($domains, $ips) = (require 'data-graph1.php');
$chart = new ezcGraphLineChart();
$chart->title = 'PHP Usage Statistics';
$chart->palette = new ezcGraphPaletteTango();
$chart->options->fillLines = 230;
$chart->legend->title = "Legend";
$chart->xAxis->font->maxFontSize = 12;
$chart->yAxis->font->maxFontSize = 12;
$chart->title->font->maxFontSize = 20;
$chart->data['domains'] = new ezcGraphArrayDataSet($domains);
$chart->data['domains']->label = 'Domains';
$chart->data['ips'] = new ezcGraphArrayDataSet($ips);
$chart->data['ips']->label = 'IP addresses';
$chart->driver = new ezcGraphSvgDriver();
$chart->render(600, 400, 'php://output');
示例15: ezcGraphLineChart
<?php
require_once 'tutorial_autoload.php';
$wikidata = (include 'tutorial_wikipedia_data.php');
$graph = new ezcGraphLineChart();
$graph->title = 'Wikipedia articles';
// Add data
foreach ($wikidata as $language => $data) {
$graph->data[$language] = new ezcGraphArrayDataSet($data);
}
$graph->yAxis->min = 0;
// Use a different axis for the norwegian dataset
$graph->additionalAxis['norwegian'] = $nAxis = new ezcGraphChartElementNumericAxis();
$nAxis->position = ezcGraph::BOTTOM;
$nAxis->chartPosition = 1;
$nAxis->min = 0;
$graph->data['Norwegian']->yAxis = $nAxis;
// Still use the marker
$graph->additionalAxis['border'] = $marker = new ezcGraphChartElementNumericAxis();
$marker->position = ezcGraph::LEFT;
$marker->chartPosition = 1 / 3;
$graph->render(400, 150, 'tutorial_line_chart_additional_axis.svg');