本文整理汇总了PHP中pData::SetSerieName方法的典型用法代码示例。如果您正苦于以下问题:PHP pData::SetSerieName方法的具体用法?PHP pData::SetSerieName怎么用?PHP pData::SetSerieName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pData
的用法示例。
在下文中一共展示了pData::SetSerieName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: draw
/**
* Рисует график по переданным данным
*
* @param array $points
* @return string путь к файлу графика
*/
private function draw(array $points)
{
$errLevel = error_reporting();
error_reporting(0);
$newsList = $this->dataProvider->getNewsList();
$classLoader = new CPChart();
$DataSet = new pData();
foreach ($points as $news_id => $set) {
$DataSet->AddPoint($set, "news" . $news_id);
$DataSet->SetSerieName($newsList[$news_id], "news" . $news_id);
}
$DataSet->AddAllSeries();
$DataSet->AddPoint(array_values($this->dataProvider->getDates()), "dates");
$DataSet->SetAbsciseLabelSerie('dates');
// Initialise the graph
$chart = new pChart(700, 250);
$chart->setFontProperties($classLoader->Cpath("Fonts/tahoma.ttf"), 7);
$chart->setGraphArea(60, 30, 570, 200);
$chart->drawFilledRoundedRectangle(7, 7, 693, 253, 5, 240, 240, 240);
$chart->drawRoundedRectangle(5, 5, 695, 255, 5, 230, 230, 230);
$chart->drawGraphArea(255, 255, 255, true);
$data = $DataSet->GetData();
if (!empty($data)) {
$chart->drawScale($data, $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, true, 45, 2, true, 3);
$chart->drawGrid(4, true, 230, 230, 230, 50);
$chart->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
// Finish the graph
$chart->setFontProperties($classLoader->Cpath("Fonts/tahoma.ttf"), 8);
$chart->drawLegend(590, 20, $DataSet->GetDataDescription(), 255, 255, 255);
}
// Restore reporting level
error_reporting($errLevel);
return $this->render($chart, $points);
}
示例2: _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");
}
示例3: 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");
}
示例4: 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;
}
示例5: make
public function make($working_path)
{
// This will import the file http://my.domain.com/myData.csv using each column as a serie
if (!$this->plot->valid()) {
$file = $this->plot->name();
$error = $this->plot->error();
$this->log($working_path, "Plot file {$file} is invalid: {$error}");
return 1;
}
$data = new pData();
$columns = array();
$all_columns = array();
$x_column = $this->plot->property('x_column') - 1;
if ($x_column === NULL) {
$x_column = 0;
}
$data_file = $this->plot->data_property('name');
$deliminator = $this->plot->data_property('deliminator');
$has_header = $this->plot->data_property('header') == 'yes';
foreach ($this->plot->columns() as $column => $name) {
if ($column != $x_column + 1) {
$columns[] = $column - 1;
}
$all_columns[] = $column - 1;
}
$data->ImportFromCSV($working_path . $data_file, $deliminator, $all_columns, $has_header);
foreach ($columns as $column) {
$name = $this->plot->column($column + 1);
$data->AddSerie('Serie' . $column);
$data->SetSerieName($name, "Serie" . $column);
}
$max_col = -1;
$max_val = NULL;
foreach ($data->GetData() as $record) {
foreach ($columns as $column) {
$point = $record['Serie' . $column];
if ($max_val === NULL || $point > $max_val) {
$max_val = $point;
$max_col = $column;
}
}
}
$x_label = $this->plot->axis_property('x', 'label');
if ($x_label) {
$data->SetXAxisName($x_label);
} else {
$data->SetXAxisName($this->plot->column($x_column + 1));
}
$x_unit = $this->plot->axis_property('x', 'unit');
if ($x_unit) {
$data->SetXAxisUnit($x_unit);
}
$y_label = $this->plot->axis_property('y', 'label');
reset($columns);
if ($y_label) {
$data->SetYAxisName($y_label);
} else {
$data->SetYAxisName($this->plot->column(current($columns) + 1));
}
$y_unit = $this->plot->axis_property('y', 'unit');
if ($y_unit) {
$data->SetyAxisUnit($y_unit);
}
$width = $this->plot->property('width');
if (!$width) {
$width = 640;
}
$height = $this->plot->property('height');
if (!$height) {
$height = 480;
}
$plot = new pChart($width, $height);
$font_name = $this->plot->property('font-name');
if (!$font_name) {
$font_name = 'tahoma.ttf';
}
$font_name = 'lib/plugins/projects/pchart/fonts/' . $font_name;
$font_size = $this->plot->property('font_size');
if (!$font_size) {
$font_size = 12;
}
$plot->setFontProperties($font_name, $font_size);
$h = $font_size + 10;
$left_margin = 0;
foreach ($data->GetData() as $record) {
$position = imageftbbox($font_size, 0, $font_name, $record['Serie' . $max_col]);
$text_width = $position[2] - $position[0];
if ($text_width > $left_margin) {
$left_margin = $text_width;
}
}
$left_margin += 2 * $h;
$plot->setGraphArea($left_margin, 2 * $h, $width - $h, $height - 2 * $h);
$background = $this->plot->property('background');
if (!$background) {
$background = array('R' => 255, 'G' => 255, 'B' => 255);
} else {
$background = html_color_to_RGB($background);
}
$plot->drawGraphArea($background['R'], $background['G'], $background['B']);
//.........这里部分代码省略.........
示例6: line
function line($valores, $titulo, $label = array())
{
$nombre = tempnam('/tmp', 'g') . '.png';
$DataSet = new pData();
$ind = 1;
$DataSet->AddPoint($valores, 'Serie' . $ind);
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$DataSet->SetSerieName($titulo, 'Serie' . $ind);
if (count($label) > 0) {
$ID = 0;
foreach ($label as $val) {
$DataSet->Data[$ID]["Name"] = $val;
$ID++;
}
}
$Test = new pChart(300, 200);
$Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 8);
$Test->setGraphArea(70, 30, 280, 170);
$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->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 8);
$Test->drawLegend(200, 9, $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;
}
示例7: addLinePlot
/**
* Registers a new plot to the current graph. Works in line-plot-mode only.
* Add a set of linePlot to a graph to get more then one line.
* If you created a bar-chart before, it it is possible to add line-plots on top of
* the bars. Nevertheless, the scale is calculated out of the bars, so make
* sure to remain inside the visible range!
* A sample-code could be:
* $objGraph = new class_graph();
* $objGraph->setStrXAxisTitle("x-axis");
* $objGraph->setStrYAxisTitle("y-axis");
* $objGraph->setStrGraphTitle("Test Graph");
*
* //simple array
* $objGraph->addLinePlot(array(1,4,6,7,4), "serie 1");
*
* //datapoints array
* $objDataPoint1 = new class_graph_datapoint(1);
* $objDataPoint2 = new class_graph_datapoint(2);
* $objDataPoint3 = new class_graph_datapoint(4);
* $objDataPoint4 = new class_graph_datapoint(5);
*
* //set action handler example
* $objDataPoint1->setObjActionHandler("<javascript code here>");
* $objDataPoint1->getObjActionHandlerValue("<value_object> e.g. some json");
*
* $objGraph->addLinePlot(array($objDataPoint1, $objDataPoint2, $objDataPoint3, $objDataPoint4) "serie 1");
*
*
* @param array $arrValues - an array with simple values or an array of data points (class_graph_datapoint).
* The advantage of a data points are that action handlers can be defined for each data point which will be executed when clicking on the data point in the chart.
* @param string $strLegend the name of the single plot
*
* @throws class_exception
* @return void
*/
public function addLinePlot($arrValues, $strLegend)
{
$arrDataPoints = class_graph_commons::convertArrValuesToDataPointArray($arrValues);
if ($this->intCurrentGraphMode > 0) {
//in bar mode, its ok. just place on top
if ($this->intCurrentGraphMode == $this->GRAPH_TYPE_BAR) {
$this->bitAdditionalDatasetAdded = true;
$strSerieName = generateSystemid();
$this->objAdditionalDataset->AddPoint(class_graph_commons::getDataPointFloatValues($arrDataPoints), $strSerieName);
$this->objAdditionalDataset->AddSerie($strSerieName);
$this->objAdditionalDataset->SetSerieName($this->stripLegend($strLegend), $strSerieName);
//jump out since only additional
return;
} else {
if ($this->intCurrentGraphMode != $this->GRAPH_TYPE_LINE) {
throw new class_exception("Chart already initialized", class_exception::$level_ERROR);
}
}
}
$this->intCurrentGraphMode = $this->GRAPH_TYPE_LINE;
$strSerieName = generateSystemid();
$this->objDataset->AddPoint(class_graph_commons::getDataPointFloatValues($arrDataPoints), $strSerieName);
$this->objDataset->AddSerie($strSerieName);
$this->objDataset->SetSerieName($this->stripLegend($strLegend), $strSerieName);
}
示例8: 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");
}
}
示例9: pData
<?php
/*
Naked: Naked and easy!
*/
// 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));
$DataSet->AddSerie();
$DataSet->SetSerieName("Sample data", "Serie1");
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setFontProperties("Fonts/tahoma.ttf", 10);
$Test->setGraphArea(40, 30, 680, 200);
$Test->drawGraphArea(252, 252, 252, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2);
$Test->drawGrid(4, TRUE, 230, 230, 230, 70);
// 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(45, 35, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties("Fonts/tahoma.ttf", 10);
$Test->drawTitle(60, 22, "My pretty graph", 50, 50, 50, 585);
$Test->Render("Naked.png");
示例10: pData
function generate_graph_image($outputfile)
{
// Create Graph Dataset and set axis attributes
$graphData = new pData();
$graphData->setYAxisName($this->ytitle);
$graphData->AddPoint($this->xlabels, "xaxis");
//$graphData->SetSerieName("xaxis","xaxis");
$graphData->SetAbsciseLabelSerie("xaxis");
$graphData->setXAxisName($this->xtitle);
// Add each series of plot values to dataset, but Reportico will
// duplicate series were the same data are displayed in different forms
// so only add each unique series once
$seriesadded = array();
foreach ($this->plot as $k => $v) {
$series = $v["name"] . $k;
$graphData->AddPoint($v["data"], $series);
$graphData->SetSerieName($v["legend"], $series);
$graphData->AddSerie($series);
}
/*
switch ( $this->xgriddisplay )
{
case "all":
$graph->xgrid->Show(true,true);
break;
case "major":
$graph->xgrid->Show(true,false);
break;
case "minor":
$graph->xgrid->Show(false,true);
break;
case "none":
default:
$graph->xgrid->Show(false,false);
break;
}
switch ( $this->ygriddisplay )
{
case "all":
$graph->ygrid->Show(true,true);
break;
case "major":
$graph->ygrid->Show(true,false);
break;
case "minor":
$graph->ygrid->Show(false,true);
break;
case "none":
default:
$graph->ygrid->Show(false,false);
break;
}
*/
/*
$graph->xaxis->SetFont($fontfamilies[$xaxisfont],$fontstyles[$xaxisfontstyle], $xaxisfontsize);
$graph->xaxis->SetColor($xaxiscolor,$xaxisfontcolor);
$graph->yaxis->SetFont($fontfamilies[$yaxisfont],$fontstyles[$yaxisfontstyle], $yaxisfontsize);
$graph->yaxis->SetColor($yaxiscolor,$yaxisfontcolor);
$graph->xaxis->title->SetFont($fontfamilies[$xtitlefont],$fontstyles[$xtitlefontstyle], $xtitlefontsize);
$graph->xaxis->title->SetColor($xtitlecolor);
$graph->yaxis->title->SetFont($fontfamilies[$ytitlefont],$fontstyles[$ytitlefontstyle], $ytitlefontsize);
$graph->yaxis->title->SetColor($ytitlecolor);
$graph->xaxis->SetLabelAngle(90);
$graph->xaxis->SetLabelMargin(15);
$graph->yaxis->SetLabelMargin(15);
$graph->xaxis->SetTickLabels($this->xlabels);
$graph->xaxis->SetTextLabelInterval($xticklabint);
$graph->yaxis->SetTextLabelInterval($yticklabint);
$graph->xaxis->SetTextTickInterval($xtickinterval);
$graph->yaxis->SetTextTickInterval($ytickinterval);
*/
/*
if ( $gridpos == "front" )
$graph->SetGridDepth(DEPTH_FRONT);
*/
// Display the graph
/*?$graph->Stroke();*/
$this->apply_defaults_internal();
//echo $this->width_pdf_actual.",".$this->height_pdf_actual."<BR>";
$graphImage = new pChart($this->width_pdf_actual, $this->height_pdf_actual);
/* Turn of Antialiasing */
$graphImage->Antialias = TRUE;
// Add gradient fill from chosen background color to white
$startgradient = htmltorgb("#ffffff");
//$graphImage->drawGradientArea(0,0,$width,$height,DIRECTION_VERTICAL,array(
//"StartR"=>$startgradient[0], "StartG"=>$startgradient[1], "StartB"=>$startgradient[2],
//"EndR"=>$color[0], "EndG"=>$color[1], "EndB"=>$color[2],"Alpha"=>100));
/* Add a border to the picture */
//$graphImage->drawRectangle(0,0,$width - 1,$height - 1,200,200,200);
$graphImage->setFontProperties(PCHARTFONTS_DIR . $this->xaxisfont, $this->xaxisfontsize);
/* Define the chart area */
$graphImage->setGraphArea($this->marginleft_actual, $this->margintop_actual, $this->width_pdf_actual - $this->marginright_actual, $this->height_pdf_actual - $this->marginbottom_actual);
$graphImage->drawFilledRoundedRectangle(3, 3, $this->width_pdf_actual - 3, $this->height_pdf_actual - 3, 5, 240, 240, 240);
$graphImage->drawRoundedRectangle(1, 1, $this->width_pdf_actual - 1, $this->height_pdf_actual - 1, 5, 230, 230, 230);
// Before plotting a series ensure they are all not drawable.
/// Plot the chart data
$stackeddrawn = false;
$linedrawn = false;
$scatterdrawn = false;
//.........这里部分代码省略.........
示例11: generate_statistics
//.........这里部分代码省略.........
$fontsize=7;
$legendtop=0.01;
$setcentrey=0.5/(($gheight/320));
}
else
{
$gheight=320;
$fontsize=8;
$legendtop=0.07;
$setcentrey=0.5;
}
// Create bar chart for Multiple choice
if ($qtype == "M" || $qtype == "P")
{
//new bar chart using data from array $grawdata which contains percentage
$DataSet = new pData;
$counter=0;
$maxyvalue=0;
foreach ($grawdata as $datapoint)
{
$DataSet->AddPoint(array($datapoint),"Serie$counter");
$DataSet->AddSerie("Serie$counter");
$counter++;
if ($datapoint>$maxyvalue) $maxyvalue=$datapoint;
}
if ($maxyvalue<10) {++$maxyvalue;}
$counter=0;
foreach ($lbl as $label)
{
$DataSet->SetSerieName($label,"Serie$counter");
$counter++;
}
if ($MyCache->IsInCache("graph".$surveyid,$DataSet->GetData()))
{
$cachefilename=basename($MyCache->GetFileFromCache("graph".$surveyid,$DataSet->GetData()));
}
else
{
$graph = new pChart(1,1);
$graph->setFontProperties($rootdir."/fonts/".$chartfontfile, $chartfontsize);
$legendsize=$graph->getLegendBoxSize($DataSet->GetDataDescription());
if ($legendsize[1]<320) $gheight=420; else $gheight=$legendsize[1]+100;
$graph = new pChart(690+$legendsize[0],$gheight);
$graph->loadColorPalette($homedir.'/styles/'.$admintheme.'/limesurvey.pal');
$graph->setFontProperties($rootdir."/fonts/".$chartfontfile,$chartfontsize);
$graph->setGraphArea(50,30,500,$gheight-60);
$graph->drawFilledRoundedRectangle(7,7,523+$legendsize[0],$gheight-7,5,254,255,254);
$graph->drawRoundedRectangle(5,5,525+$legendsize[0],$gheight-5,5,230,230,230);
$graph->drawGraphArea(255,255,255,TRUE);
$graph->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_START0,150,150,150,TRUE,90,0,TRUE,5,false);
$graph->drawGrid(4,TRUE,230,230,230,50);
// Draw the 0 line
$graph->setFontProperties($rootdir."/fonts/".$chartfontfile,$chartfontsize);
$graph->drawTreshold(0,143,55,72,TRUE,TRUE);
// Draw the bar graph
$graph->drawBarGraph($DataSet->GetData(),$DataSet->GetDataDescription(),FALSE);
//$Test->setLabel($DataSet->GetData(),$DataSet->GetDataDescription(),"Serie4","1","Important point!");
// Finish the graph
示例12: pData
/*
Example19 : Error reporting
*/
// Standard inclusions
include "pChart/pData.class";
include "pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint(array(10, 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, 30), "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$DataSet->SetXAxisName("Samples");
$DataSet->SetYAxisName("Temperature");
$DataSet->SetSerieName("January", "Serie1");
// Initialise the graph
$Test = new pChart(700, 230);
$Test->reportWarnings("GD");
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(60, 30, 585, 185);
$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->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
示例13: pData
} else {
array_push($arrtotalamt, 0);
}
}
//print_r($arrtotalamt);
//print_r($p);
//echo "?? $minquoteamtinmonth ???";
//die;
$DataSet = new pData();
$DataSet->AddPoint(array($arrtotalamt[0], $arrtotalamt[1], $arrtotalamt[2], $arrtotalamt[3], $arrtotalamt[4], $arrtotalamt[5]), "Serie1");
$DataSet->AddPoint(array($minquoteamtinmonth, $minquoteamtinmonth, $minquoteamtinmonth, $minquoteamtinmonth, $minquoteamtinmonth, $minquoteamtinmonth), "Serie2");
$DataSet->AddPoint(array($p[0], $p[1], $p[2], $p[3], $p[4], $p[5]), "Serie3");
$DataSet->AddSerie("Serie1");
$DataSet->AddSerie("Serie2");
$DataSet->SetAbsciseLabelSerie("Serie3");
$DataSet->SetSerieName("Amount", "Serie1");
$DataSet->SetSerieName("Control ({$minquoteamtinmonth})", "Serie2");
$DataSet->SetYAxisName("Amount({$defcurrencycode})");
// $DataSet->SetYAxisUnit("RM");
$Test = new pChart(600, 230);
$Test->setFontProperties("../simantz/class/pchart/Fonts/tahoma.ttf", 8);
$Test->setGraphArea(65, 30, 550, 200);
$Test->drawFilledRoundedRectangle(7, 7, 593, 223, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 595, 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);
$Test->writeValues($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie1");
// Draw the title
$Test->setFontProperties("../simantz/class/pchart/Fonts/pf_arma_five.ttf", 8);
$Title = "QUotation Amount Vs Time For {$defaultorganization_name}";
示例14: pData
Example15 : Playing with line style & pictures inclusion
*/
// Standard inclusions
include "pChart/pData.class";
include "pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
// $DataSet->AddPoint(array(10,9.4,7.7,5,1.7,-1.7,-5,-7.7,-9.4,-10,-9.4,-7.7,-5,-1.8,1.7),"Serie1");
// $DataSet->AddPoint(array(0,3.4,6.4,8.7,9.8,9.8,8.7,6.4,3.4,0,-3.4,-6.4,-8.6,-9.8,-9.9),"Serie2");
$DataSet->AddPoint(array(7.1, 9.1, 10, 9.699999999999999, 8.199999999999999, 5.7, 2.6, -0.9, -4.2, -7.1, -9.1, -10, -9.699999999999999, -8.199999999999999, -5.8), "Serie3");
// $DataSet->AddPoint(array("Jan","Jan","Jan","Feb","Feb","Feb","Mar","Mar","Mar","Apr","Apr","Apr","May","May","May"),"Serie4");
$DataSet->AddAllSeries();
// $DataSet->SetAbsciseLabelSerie("Serie4");
// $DataSet->SetSerieName("Max Average","Serie1");
// $DataSet->SetSerieName("Min Average","Serie2");
$DataSet->SetSerieName("Temperature", "Serie3");
$DataSet->SetYAxisName("Kg");
$DataSet->SetXAxisName("week");
// Initialise the graph
$Test = new pChart(600, 230);
$Test->reportWarnings("GD");
$Test->setFixedScale(-12, 13, 5);
//
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(65, 20, 570, 185);
$Test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 243, 249, 249);
$Test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$Test->drawGraphArea(243, 249, 249, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, TRUE, 3);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
示例15: pData
<?php
/*
Example24 : X versus Y chart
*/
// Standard inclusions
include "pChart/pData.class";
include "pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
// Compute the points
for ($i = 0; $i <= 360; $i = $i + 10) {
$DataSet->AddPoint(cos($i * 3.14 / 180) * 80 + $i, "Serie1");
$DataSet->AddPoint(sin($i * 3.14 / 180) * 80 + $i, "Serie2");
}
$DataSet->SetSerieName("Trigonometric function", "Serie1");
$DataSet->AddSerie("Serie1");
$DataSet->AddSerie("Serie2");
$DataSet->SetXAxisName("X Axis");
$DataSet->SetYAxisName("Y Axis");
// Initialise the graph
$Test = new pChart(300, 300);
$Test->drawGraphAreaGradient(0, 0, 0, -100, TARGET_BACKGROUND);
// Prepare the graph area
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(55, 30, 270, 230);
$Test->drawXYScale($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie1", "Serie2", 213, 217, 221, TRUE, 45);
$Test->drawGraphArea(213, 217, 221, FALSE);
$Test->drawGraphAreaGradient(30, 30, 30, -50);
$Test->drawGrid(4, TRUE, 230, 230, 230, 20);
// Draw the chart