本文整理汇总了PHP中pChart::drawTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP pChart::drawTitle方法的具体用法?PHP pChart::drawTitle怎么用?PHP pChart::drawTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pChart
的用法示例。
在下文中一共展示了pChart::drawTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: drawPie
/**
* Draw pie chart
* @return unknown
*/
protected function drawPie()
{
// prepare font & series
$this->_prepareSerie();
$this->_prepareFont();
// init chart params
$outer_w = $this->w - 5;
// Outer frame witdh
$outer_h = $this->h - 5;
// Outer frame heigth
$inner_w = $this->w - 7;
// Inner frame witdh
$inner_h = $this->h - 7;
// Inner frame heigth
$pie_x = intval(($this->w - 150) / 2);
// Pie witdh
$pie_y = intval(($this->h - 10) / 2);
// Pie heigth
$pie_r = intval($pie_x - 50);
// Pie radius
$title_w = $this->w - 200;
// Title width
$title_h = 50;
// Title height
$legend_w = $this->w - 120;
// Legend width
$legend_h = 50;
// Legend height
// chart styles
$flat = isset($this->p['flat']) ? $this->p['flat'] : false;
// fill chart
$this->chart->drawBackground(255, 255, 255);
$this->chart->setFontProperties($this->font, 7);
// set font and size
$this->chart->drawRoundedRectangle(5, 5, $outer_w, $outer_h, 10, 230, 230, 230);
// drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$R,$G,$B)
$this->chart->drawFilledRoundedRectangle(7, 7, $inner_w, $inner_h, 10, 240, 240, 240);
// drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$R,$G,$B)
// draw the pie chart
$this->chart->setFontProperties($this->font, 8);
// flat pie
if ($flat) {
$this->chart->drawFlatPieGraphWithShadow($this->data->GetData(), $this->data->GetDataDescription(), $pie_x, $pie_y, $pie_r, PIE_PERCENTAGE, 10);
// 3d pie
} else {
$this->chart->drawPieGraph($this->data->GetData(), $this->data->GetDataDescription(), $pie_x, $pie_y, $pie_r, PIE_PERCENTAGE, TRUE, 50, 20, 5, 1);
}
$this->chart->drawPieLegend($legend_w, $legend_h, $this->data->GetData(), $this->data->GetDataDescription(), 250, 250, 250);
// add title
$this->chart->setFontProperties($this->font, 10);
$this->chart->drawTitle(40, 0, $this->title, 50, 50, 50, $title_w, $title_h);
// drawTitle($XPos,$YPos,$Value,$R,$G,$B,$XPos2=-1,$YPos2=-1,$Shadow=FALSE)
}
示例2: pData
// Standard inclusions
include "pChart/pData.class";
include "pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint(array(1, 4, 3, 2, 3, 3, 2, 1, 0, 7, 4, 3, 2, 3, 3, 5, 1, 0, 7), "Serie1");
$DataSet->AddPoint(array(1, 4, 2, 6, 2, 3, 0, 1, 5, 1, 2, 4, 5, 2, 1, 0, 6, 4, 2), "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$DataSet->SetSerieName("January", "Serie1");
$DataSet->SetSerieName("February", "Serie2");
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(50, 30, 585, 200);
$Test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties("Fonts/tahoma.ttf", 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the cubic curve graph
$Test->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 50);
// Finish the graph
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->drawLegend(600, 30, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties("Fonts/tahoma.ttf", 10);
$Test->drawTitle(50, 22, "Example 7", 50, 50, 50, 585);
$Test->Render("example7.png");
示例3: _showGraph_pChart
public function _showGraph_pChart($buscarBarra)
{
// Dataset definition
$DataSet = new pData();
if ($buscarBarra == "semana") {
$semana = array("1era Semana", "2da Semana", "3era Semana", "4ta Semana");
$cantidadSemanal = array(2, 4, 5, 6);
$DataSet->AddPoint($semana, "Serie1");
$DataSet->AddPoint($cantidadSemanal, "Serie2");
// Initialise the graph
define("WIDTH", 500);
define("HEIGHT", 500);
$Test = new pChart(WIDTH, HEIGHT);
$Test->setFontProperties("../font/arial.ttf", 7);
$Test->setGraphArea(40, 30, WIDTH - 30, HEIGHT - 30);
$Test->drawFilledRoundedRectangle(7, 7, WIDTH - 7, HEIGHT - 7, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, WIDTH - 5, HEIGHT - 5, 5, 230, 230, 230);
} elseif ($buscarBarra == "mes") {
$mensual = array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Setiembre", "Octubre");
$cantidadMensual = array(4, 6, 11, 23, 9, 2, 30, 20, 12, 45);
$DataSet->AddPoint($mensual, "Serie1");
$DataSet->AddPoint($cantidadMensual, "Serie2");
// Initialise the graph
define("WIDTH", 700);
define("HEIGHT", 500);
$Test = new pChart(WIDTH, HEIGHT);
$Test->setFontProperties("../font/arial.ttf", 7);
$Test->setGraphArea(40, 30, WIDTH - 30, HEIGHT - 30);
$Test->drawFilledRoundedRectangle(7, 7, WIDTH - 7, HEIGHT - 7, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, WIDTH - 5, HEIGHT - 5, 5, 230, 230, 230);
$Test->setColorPalette(0, 224, 100, 46);
}
$DataSet->AddAllSeries();
$DataSet->RemoveSerie("Serie1");
$DataSet->SetAbsciseLabelSerie("Serie1");
$DataSet->SetSerieName("Productos Comprados", "Serie2");
// Initialise the graph
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, 0, 2, TRUE);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties("../font/arial.ttf", 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the bar graph
$Test->drawStackedBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 70);
// Set labels
$Test->setFontProperties("../font/arial.ttf", 7);
$Test->writeValues($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie2");
// Finish the graph
$Test->setFontProperties("../font/arial.ttf", 8);
$Test->drawLegend(WIDTH / 5, 25, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties("../font/arial.ttf", 10);
$Test->drawTitle(WIDTH - 200, 22, "Estadistica de Barra de Grafico", 50, 50, 50, 185);
$Test->Render("../img/imagenBarra_pChart.png");
}
示例4: bar
function bar($valores, $label, $titulo)
{
$nombre = tempnam('/tmp', 'g') . '.png';
$DataSet = new pData();
foreach ($valores as $ind => $val) {
$DataSet->AddPoint(array($val), 'Serie' . $ind);
$DataSet->SetSerieName($label[$ind], 'Serie' . $ind);
}
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$Test = new pChart(300, 200);
$Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 8);
$Test->setGraphArea(60, 40, 250, 180);
$Test->drawFilledRoundedRectangle(7, 7, 293, 193, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 295, 195, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, true, 0, 0);
$Test->drawGrid(4, TRUE, 200, 200, 200, 50);
$Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
$Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE);
//$Test->drawOverlayBarGraph($DataSet->GetData(),$DataSet->GetDataDescription());
$Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 8);
$Test->drawLegend(220, 7, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 10);
$Test->drawTitle(10, 22, $titulo, 50, 50, 50, 300);
$Test->Render($nombre);
return $nombre;
}
示例5: drawChart
function drawChart($title, $DataSet, $type, $colors, $legend = false)
{
// Initialise the graph
$Chart = new pChart(1300, 700);
$Chart->setFontProperties("Fonts/tahoma.ttf", 8);
$Chart->setGraphArea(50, 50, 1200, 600);
$Chart->drawGraphArea(255, 255, 255, TRUE);
$Chart->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 0, TRUE);
// Draw the 0 line
$Chart->setFontProperties("Fonts/tahoma.ttf", 6);
$Chart->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
foreach ($colors as $idx => $color) {
$Chart->setColorPalette($idx, $color[0], $color[1], $color[2]);
}
if ($type == "bar") {
$Chart->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription());
} else {
if ($type == "line") {
$Chart->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
}
}
if ($legend) {
$Chart->drawLegend(465, 40, $DataSet->GetDataDescription(), 255, 255, 255);
}
// Finish the graph
$Chart->setFontProperties("Fonts/tahoma.ttf", 10);
$Chart->drawTitle(60, 22, $title, 50, 50, 50, 530);
$Chart->Stroke();
}
示例6: createGraphToFile
/**
* Генерация графика
* @param DataSet $DataSet
* @param String $GraphTitle
* @param String $safeToFile
*/
function createGraphToFile($DataSet, $GraphTitle, $safeToFile, $scaleFormat)
{
// Rotrate
$rotate = 30;
// Initialise the graph
$GraphImage = new pChart(594, 344);
$GraphImage->setDateFormat($scaleFormat);
// $GraphImage->loadColorPalette(DIR_FONT.'/tones-3.txt');
$GraphImage->setFontProperties(DIR_FONT . "/segoepr.ttf", 8);
$GraphImage->setGraphArea(80, 50, 580, 300);
$GraphImage->drawFilledRectangle(3, 3, 590, 340, 240, 240, 240);
$GraphImage->drawRectangle(0, 0, 593, 343, 230, 230, 230);
$GraphImage->drawGraphArea(255, 255, 255, TRUE);
$GraphImage->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, $rotate, 0, FALSE);
$GraphImage->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$GraphImage->setFontProperties(DIR_FONT . "/segoepr.ttf", 6);
$GraphImage->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Просто пунктирная линия
// Draw the cubic curve graph
$GraphImage->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
// Draw the line graph
//$GraphImage->drawLineGraph($DataSet->GetData(),$DataSet->GetDataDescription());
$GraphImage->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
// Finish the graph
$GraphImage->setFontProperties(DIR_FONT . "/segoepr.ttf", 12);
$GraphImage->drawTitle(60, 32, $GraphTitle, 50, 50, 50, 600);
//$GraphImage->Render(DIR_CACHE . './' . $safeToFile . '.png');
$GraphImage->Stroke();
}
示例7: generateGraph
function generateGraph($year, $month, $quarter, $biAnn, $dev, $patna, $duration, $from, $to)
{
$myarr = graphTests($year, $month, $quarter, $biAnn, $dev, $patna, $duration, $from, $to);
$myarr1 = graphErrs($year, $month, $quarter, $biAnn, $dev, $patna, $duration, $from, $to);
$myarr2 = graphLbls($year, $month, $quarter, $biAnn, $dev, $patna, $duration, $from, $to);
// Standard inclusions
include "pChart/pChart/pData.class";
include "pChart/pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($myarr, "Serie1");
$DataSet->AddPoint($myarr1, "Serie2");
$DataSet->AddPoint($myarr2, "Serie3");
$DataSet->AddSerie("Serie1");
$DataSet->AddSerie("Serie2");
$DataSet->SetAbsciseLabelSerie("Serie3");
$DataSet->SetSerieName("Test Resulting trends", "Serie1");
$DataSet->SetSerieName("Errors in tests", "Serie2");
$DataSet->SetYAxisName("Tests");
// $DataSet->SetYAxisFormat("time");
$DataSet->SetXAxisName("months");
// Initialise the graph
$Test = new pChart(750, 330);
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(85, 30, 650, 200);
$Test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties("Fonts/tahoma.ttf", 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the line graph
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
// Finish the graph
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->drawLegend(90, 35, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties("Fonts/tahoma.ttf", 10);
$Test->drawTitle(60, 22, "Test Summary", 50, 50, 50, 585);
$Test->Render("mpdf.png");
}
示例8: make
//.........这里部分代码省略.........
foreach ($columns as $column) {
$name = $this->plot->column($column + 1);
$style = $this->plot->line_style($name, 'style');
$line_color = $this->plot->line_style($name, 'color');
if (!$line_color) {
$colors[$name] = array('R' => 0, 'G' => 0, 'B' => 0);
} else {
$colors[$name] = html_color_to_RGB($line_color);
}
$plot->setColorPalette($line_no, $colors[$name]['R'], $colors[$name]['G'], $colors[$name]['B']);
if (!$style || $style == 'line' || $style == 'both') {
$line_width = $this->plot->line_style($name, 'width');
if (!$line_width) {
$line_width = 1;
}
$dot_size = $this->plot->line_style($name, 'dot-size');
if (!$dot_size) {
$dot_size = 0;
}
$plot->setLineStyle($line_width, $dot_size);
$plot->drawXYGraph($data->GetData(), $data->GetDataDescription(), 'Serie' . $column, 'Serie' . $x_column, $line_no);
}
if ($style == 'point' || $style == 'both') {
$radius = $this->plot->line_style($name, 'radius');
if (!$radius) {
$radius = 5;
}
$plot->drawXYPlotGraph($data->GetData(), $data->GetDataDescription(), 'Serie' . $column, 'Serie' . $x_column, $line_no, $radius, $radius - 2);
}
$line_no++;
}
$title = $this->plot->property('title');
foreach ($columns as $column) {
$data->removeSerie('Serie' . $column);
}
$in_legend = array();
$description = $data->GetDataDescription();
$description['Description'] = array();
$palette_id = 0;
foreach ($columns as $column) {
$name = $this->plot->column($column + 1);
if (in_array($name, $in_legend)) {
continue;
}
$in_legend[] = $name;
$description['Description']['Serie' . $column] = $name;
$plot->setColorPalette($palette_id, $colors[$name]['R'], $colors[$name]['G'], $colors[$name]['B']);
++$palette_id;
}
$legend_box_size = $plot->getLegendBoxSize($description);
$legend_position = $this->plot->property('legend-position');
if (!$legend_position) {
$legend_position = 'top-left';
}
switch ($legend_position) {
case 'top-left':
$legend_left = 0;
$legend_top = 0;
break;
case 'top':
$legend_left = ($width - $h - $left_margin - $legend_box_size[0]) / 2;
$legend_top = 0;
break;
case 'top-right':
$legend_left = $width - $left_margin - $h - $legend_box_size[0];
$legend_top = 0;
break;
case 'left':
$legend_left = 0;
$legend_top = ($height - 4 * $h - $legend_box_size[1]) / 2;
break;
case 'center':
$legend_left = ($width - $h - $left_margin - $legend_box_size[0]) / 2;
$legend_top = ($height - 4 * $h - $legend_box_size[1]) / 2;
break;
case 'right':
$legend_left = $width - $left_margin - $h - $legend_box_size[0];
$legend_top = ($height - 4 * $h - $legend_box_size[1]) / 2;
break;
case 'bottom-left':
$legend_left = 0;
$legend_top = $height - 4 * $h - $legend_box_size[1];
break;
case 'bottom':
$legend_left = ($width - $h - $left_margin - $legend_box_size[0]) / 2;
$legend_top = $height - 4 * $h - $legend_box_size[1];
break;
case 'bottom-right':
$legend_left = $width - $left_margin - $h - $legend_box_size[0];
$legend_top = $height - 4 * $h - $legend_box_size[1];
break;
}
$plot->drawLegend($left_margin + $legend_left, 2 * $h + $legend_top, $description, 255, 255, 255, 100, 100, 100, 0, 0, 0, true);
$plot->drawTitle($h, 0, $title, 0, 0, 0, $width - $h, $h * 2, 100);
$plot->Render($this->path($working_path));
$file_name = $this->plot->name();
$plot_name = $this->name();
$this->log($working_path, "Successfully plotted {$file_name} as {$plot_name}\ntitle: {$title}\n");
return 0;
}
示例9: makeGraph
function makeGraph($values, $labels)
{
$values[] = '0';
$labels[] = '';
// Standard inclusions
include_once "charts/pChart.class";
include_once "charts/pData.class";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($values, "Serie2");
$DataSet->AddPoint($labels, "Xlabel");
$DataSet->AddSerie("Serie2");
$DataSet->SetAbsciseLabelSerie('Xlabel');
$DataSet->SetSerieName("No Of Births", "Serie2");
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(50, 30, 585, 200);
$Test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, TRUE);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties("Fonts/tahoma.ttf", 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the bar graph
$Test->drawOverlayBarGraph($DataSet->GetData(), $DataSet->GetDataDescription());
// Finish the graph
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->drawLegend(600, 30, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties("Fonts/tahoma.ttf", 10);
$Test->drawTitle(50, 22, "Change in name popularity", 50, 50, 50, 585);
ob_start();
$Test->Stroke();
$img = ob_get_clean();
$img = base64_encode($img);
return $img;
}
示例10: generateGraph
/**
* Create graph (a .png file)
*
* @param string $file
*/
public function generateGraph($file)
{
$patientValues = Storage::getInstance()->getPatientsData($file);
/*
* pGraph work
*/
$dataSet = new pData();
if (!empty($patientValues)) {
$dataSet->AddPoint(array_keys($patientValues[$file]), 'label');
$dataSet->SetAbsciseLabelSerie('label');
$serie1 = array_values($patientValues[$file]);
$average = round(array_sum($serie1) / count($serie1), 2);
$dataSet->AddPoint($serie1, "Serie1");
$dataSet->AddSerie("Serie1");
// Initialise the graph
$graph = new MyHorBar(450, 600);
$graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 8);
$graph->setGraphArea(120, 60, 410, 550);
$graph->drawFilledRoundedRectangle(7, 7, 443, 593, 5, 240, 240, 240);
$graph->drawRoundedRectangle(5, 5, 443, 595, 5, 230, 230, 230);
$graph->drawGraphArea(255, 255, 255, true);
$graph->drawHorScale($dataSet->GetData(), $dataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, true, 0, 2, true);
$graph->drawHorGrid(10, true, 230, 230, 230, 50);
// Draw the 0 line
$graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 6);
$graph->drawTreshold($average, 143, 55, 72, true, false, 2, null, 90);
// Draw the bar graph
$graph->drawHorBarGraph($dataSet->GetData(), $dataSet->GetDataDescription(), false);
// Finish the graph
$graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 10);
$graph->drawLegend(15, 15, $dataSet->GetDataDescription(), 255, 255, 255);
$graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 10);
$graph->drawTitle(170, 27, $file, 50, 50, 50, -1);
} else {
$graph = new pChart(450, 150);
$graph->setGraphArea(120, 60, 410, 100);
$graph->drawFilledRoundedRectangle(7, 7, 443, 143, 5, 240, 240, 240);
$graph->drawRoundedRectangle(5, 5, 443, 145, 5, 230, 230, 230);
$graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 10);
$graph->drawTitle(170, 27, $file, 50, 50, 50, -1);
$graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 36);
$graph->drawTitle(125, 90, 'No data!', 245, 50, 50, -1);
}
$graph->Render(WWW_DIR . '/images/graphs/' . $file . '.png');
}
示例11: writeBarData
function writeBarData($data, $graph)
{
if ($data != "") {
echo "Plottong " . $graph . "\n";
$dataset1 = array();
$dataset2 = array();
$counter = 0;
$toggle = true;
$data = array_reverse($data, TRUE);
ksort($data);
foreach ($data as $key => $value) {
if ($counter % 5 != 0) {
$key = " ";
}
array_push($dataset1, $key);
array_push($dataset2, $value);
$counter++;
}
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($dataset2, "Serie1");
$DataSet->AddPoint($dataset1, "XLabel");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("XLabel");
$DataSet->RemoveSerie("XLabel");
$DataSet->SetSerieName("Membership", "Serie1");
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(50, 30, 680, 200);
$Test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), 'SCALE_NORMAL', 150, 150, 150, TRUE, 0, 2, TRUE);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties("Fonts/tahoma.ttf", 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the bar graph
$Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE);
// Finish the graph
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->drawLegend(596, 150, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties("Fonts/tahoma.ttf", 10);
$Test->drawTitle(50, 22, "Membership by Month", 50, 50, 50, 585);
$Test->Render("{$graph}-bar.png");
}
}
示例12: generate_image
function generate_image($site_name, $visits)
{
$font = APP_PATH . "libs/pchart/Fonts/tahoma.ttf";
//$font = APP_PATH."includes/pchart/Fonts/DejaVuSans.ttf";
global $lang;
// Dataset definition
$DataSet = new pData();
$names = array();
$points = array();
foreach ($visits as $date => $visit) {
$points[] = $visit;
$text = $lang['days'][date('N', strtotime($date))];
$names[] = $text;
}
$DataSet->AddPoint($points, "Lankytojai");
$DataSet->AddPoint($names, "days");
$DataSet->AddAllSeries();
$DataSet->RemoveSerie("days");
$DataSet->SetAbsciseLabelSerie('days');
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setFontProperties($font, 8);
$Test->setGraphArea(50, 30, 680, 200);
$Test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, TRUE);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties($font, 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the bar graph
$Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE, 80);
// Finish the graph
$Test->setFontProperties($font, 8);
// $Test->drawLegend(100,20,$DataSet->GetDataDescription(),255,255,255);
$Test->drawLegend(610, 10, $DataSet->GetDataDescription(), 236, 238, 240, 52, 58, 82);
$Test->setFontProperties($font, 10);
$Test->drawTitle(50, 22, $site_name, 50, 50, 50, 585);
$path = IMAGE_PATH . "{$site_name}.png";
if (file_exists($path)) {
unlink($path);
}
$Test->Render($path);
return $path;
}
示例13:
$Test->drawGrid(4, TRUE, 230, 230, 230, 10);
$Test->setShadowProperties(3, 3, 0, 0, 0, 30, 4);
$Test->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->clearShadow();
$Test->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 30);
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
// Clear the scale
$Test->clearScale();
// Draw the 2nd graph
/*$DataSet->RemoveSerie("Serie1");
$DataSet->AddSerie("Serie2");
$DataSet->SetYAxisName("Web Hits");
$Test->drawRightScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,213,217,221,TRUE,0,0);
$Test->drawGrid(4,TRUE,230,230,230,10);
$Test->setShadowProperties(3,3,0,0,0,30,4);
$Test->drawCubicCurve($DataSet->GetData(),$DataSet->GetDataDescription());
$Test->clearShadow();
$Test->drawFilledCubicCurve($DataSet->GetData(),$DataSet->GetDataDescription(),.1,30);
$Test->drawPlotGraph($DataSet->GetData(),$DataSet->GetDataDescription(),3,2,255,255,255); */
// Write the legend (box less)
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
$Test->drawLegend(530, 5, $DataSet->GetDataDescription(), 0, 0, 0, 0, 0, 0, 255, 255, 255, FALSE);
// Write the title
$Test->setFontProperties("../Fonts/tahoma.ttf", 18);
$Test->setShadowProperties(1, 1, 0, 0, 0);
$Test->drawTitle(0, 0, "Comparison of Fuel usage in 2015", 255, 255, 255, 660, 30, TRUE);
$Test->clearShadow();
// Render the picture
$Test->Render("clientsGraph.png");
?>
示例14: pChart
$DataSet->AddPoint($array_to_display, "Serie1");
$DataSet->AddPoint(array("Jan", "Fev", "Mars", "Avril", "Mai", "Juin", "Juillet", "Aout", "Sept.", "Oct.", "Nov.", "Dec."), "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
$DataSet->SetSerieName("{$machine_to_display}", "Serie1");
$DataSet->SetXAxisName("Mois");
$DataSet->SetYAxisName("temps par panne");
$DataSet->SetYAxisUnit(" min");
// Initialise the graph
$Test = new pChart(500, 250);
$Test->setFontProperties("../../pChart/Fonts/tahoma.ttf", 10);
$Test->setGraphArea(85, 30, 480, 200);
$Test->drawFilledRoundedRectangle(7, 7, 493, 243, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 495, 225, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties("../../pChart/Fonts/tahoma.ttf", 10);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the line graph
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
$Test->writeValues($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie1");
// Finish the graph
$Test->setFontProperties("../../pChart/Fonts/tahoma.ttf", 8);
//$Test->drawLegend(75,35,$DataSet->GetDataDescription(),255,255,255);
$Test->setFontProperties("../../pChart/Fonts/tahoma.ttf", 10);
$Test->drawTitle(60, 22, "Temps moyen par panne par mois", 50, 50, 50, 585);
//$Test->Render("example1.png");
$Test->stroke();
示例15: minmaxValueOfSeries
}
// Draw Legend if legend value has been set
$drawlegend = false;
foreach ($plot as $k => $v) {
if (isset($v["legend"]) && $v["legend"]) {
// Temporarily Dont draw legend for Pie
//if ( $piechart )
//$graphImage->drawPieLegend($width - 180,30,$graphData->GetData(), $graphData->GetDataDescription(), 250, 250, 250);
if (!$piechart) {
$graphImage->drawLegend($width - 180, 30, $graphData->GetDataDescription(), 254, 254, 254, 0, 0, 0);
}
break;
}
}
$graphImage->setFontProperties(PCHARTFONTS_DIR . $xtitlefont, $titlefontsize);
$graphImage->drawTitle(0, 24, $title, 50, 50, 50, $width);
//$graphImage->setShadow(TRUE,array("X"=>0,"Y"=>0,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
//$graphImage->Render("example.png");
$graphImage->Stroke();
function minmaxValueOfSeries($data, &$min, &$max)
{
$min = "undef";
$max = "undef";
foreach ($data as $v) {
if ($min == "undef" || $v < $min) {
$min = $v;
}
if ($max == "undef" || $v > $max) {
$max = $v;
}
}