本文整理汇总了PHP中LinePlot::setLegend方法的典型用法代码示例。如果您正苦于以下问题:PHP LinePlot::setLegend方法的具体用法?PHP LinePlot::setLegend怎么用?PHP LinePlot::setLegend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinePlot
的用法示例。
在下文中一共展示了LinePlot::setLegend方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Line
/**
*Funcion que crea graficas tipo Linea
*@param array() $data Array en el cual estan los datos para Y array(1, 2.3, 3, 4)
*@param string $legend Título de los datos de la línea
*@param string $color Color de la linea
*@param int $weight Grueso de la Linea
*/
function Line($data, $legend = null, $color = '#000000', $weight = 1)
{
vendor('jpgraph/jpgraph_line');
$line = new LinePlot($data);
$line->setLegend($legend);
$line->setColor($color);
$line->setWeight($weight);
#Adicion de linea a la grafica
$this->graph->Add($line);
if (strlen($legend) > $this->maxLength) {
$this->maxLength = strlen($legend);
}
}
示例2: formatearArreglo
//Se optionen los datos del postulante seleccionado
$valoresReferencia = formatearArreglo($operacionesPostulante->valoresReferencia);
//Se optionen los valores de referencia
$campos = $operacionesPostulante->campos;
//Se optinen las atributos a evaluar por la empresa (nombre de los valores de referencia)
$nombrePostulante = $operacionesPostulante->nombrePostulanteSeleccionado;
//echo"<br/>Losssssssssss datos postulante son: ".var_dump($datosPostulante)."<br/>";
//echo"losssss valore de referencia son: ".var_dump($valoresReferencia)." <br/>";
$graph = new Graph(820, 350, "auto");
$graph->SetScale("textlin");
$graph->img->SetMargin(40, 20, 20, 40);
$graph->img->SetAntiAliasing();
$graph->title->Set("Comparacion con Valores de Referencia");
$graph->yaxis->title->Set("Valores");
$graph->xaxis->SetTickLabels($campos);
$lineplot1 = new LinePlot($datosPostulante);
$lineplot1->SetColor("blue");
$lineplot1->setLegend($nombrePostulante);
$lineplot2 = new LinePlot($valoresReferencia);
$lineplot2->SetColor("red");
$lineplot2->setLegend("Valores de Referencia");
$graph->Add($lineplot1);
$graph->Add($lineplot2);
$graph->Stroke();
function formatearArreglo($arreglo)
{
for ($i = 0; $i <= count($arreglo); $i++) {
$arregloSalida[$i] = (double) $arreglo[$i];
}
return $arregloSalida;
}
示例3: visitor_week
/**
* Collects and renders visitor/week report data
*/
public function visitor_week()
{
$myConfig = $this->getConfig();
$oDb = oxDb::getDb();
$aDataX = array();
$aDataX2 = array();
$aDataX3 = array();
$aDataY = array();
$sTimeTo = $oDb->quote(date("Y-m-d H:i:s", strtotime(oxRegistry::getConfig()->getRequestParameter("time_to"))));
$sTimeFrom = $oDb->quote(date("Y-m-d H:i:s", strtotime(oxRegistry::getConfig()->getRequestParameter("time_from"))));
$sSQL = "select oxtime, count(*) as nrof from oxlogs where oxtime >= {$sTimeFrom} and oxtime <= {$sTimeTo} group by oxsessid order by oxtime";
$aTemp = array();
$rs = $oDb->execute($sSQL);
if ($rs != false && $rs->recordCount() > 0) {
while (!$rs->EOF) {
//$aTemp[date( "W", strtotime( $rs->fields[0]))]++;
$aTemp[oxRegistry::get("oxUtilsDate")->getWeekNumber($myConfig->getConfigParam('iFirstWeekDay'), strtotime($rs->fields[0]))]++;
$rs->moveNext();
}
}
// initializing
list($iFrom, $iTo) = $this->getWeekRange();
for ($i = $iFrom; $i < $iTo; $i++) {
$aDataX[$i] = 0;
$aDataX2[$i] = 0;
$aDataX3[$i] = 0;
$aDataY[] = "KW " . $i;
}
foreach ($aTemp as $key => $value) {
$aDataX[$key] = $value;
$aDataX2[$key] = 0;
$aDataX3[$key] = 0;
$aDataY[] = "KW " . $key;
}
// buyer
$sSQL = "select oxorderdate from oxorder where oxorderdate >= {$sTimeFrom} and oxorderdate <= {$sTimeTo} order by oxorderdate";
$rs = $oDb->execute($sSQL);
if ($rs != false && $rs->recordCount() > 0) {
while (!$rs->EOF) {
$sKey = oxRegistry::get("oxUtilsDate")->getWeekNumber($myConfig->getConfigParam('iFirstWeekDay'), strtotime($rs->fields[0]));
if (isset($aDataX2[$sKey])) {
$aDataX2[$sKey]++;
}
$rs->moveNext();
}
}
// newcustomer
$sSQL = "select oxtime, oxsessid from oxlogs where oxtime >= {$sTimeFrom} and oxtime <= {$sTimeTo} group by oxsessid order by oxtime";
$rs = $oDb->execute($sSQL);
if ($rs != false && $rs->recordCount() > 0) {
while (!$rs->EOF) {
$sKey = oxRegistry::get("oxUtilsDate")->getWeekNumber($myConfig->getConfigParam('iFirstWeekDay'), strtotime($rs->fields[0]));
if (isset($aDataX3[$sKey])) {
$aDataX3[$sKey]++;
}
$rs->moveNext();
}
}
header("Content-type: image/png");
// New graph with a drop shadow
$graph = new Graph(max(800, count($aDataX) * 80), 600);
$graph->setBackgroundImage($myConfig->getImageDir(true) . "/reportbgrnd.jpg", BGIMG_FILLFRAME);
// Use a "text" X-scale
$graph->setScale("textlin");
$graph->setY2Scale("lin");
$graph->y2axis->setColor("red");
// Label align for X-axis
$graph->xaxis->setLabelAlign('center', 'top', 'right');
// Label align for Y-axis
$graph->yaxis->setLabelAlign('right', 'bottom');
$graph->setShadow();
// Description
$graph->xaxis->setTickLabels($aDataY);
// Set title and subtitle
$graph->title->set("Woche");
// Use built in font
$graph->title->setFont(FF_FONT1, FS_BOLD);
$aDataFinalX = array();
foreach ($aDataX as $dData) {
$aDataFinalX[] = $dData;
}
// Create the bar plot
$l2plot = new LinePlot($aDataFinalX);
$l2plot->setColor("navy");
$l2plot->setWeight(2);
$l2plot->setLegend("Besucher");
$l2plot->value->setColor("navy");
$l2plot->value->setFormat('% d');
$l2plot->value->hideZero();
$l2plot->value->show();
$aDataFinalX2 = array();
foreach ($aDataX2 as $dData) {
$aDataFinalX2[] = $dData;
}
// Create the bar plot
$l3plot = new LinePlot($aDataFinalX2);
$l3plot->setColor("orange");
//.........这里部分代码省略.........
示例4: addData
/**
* adds new plot to the graph
*
* @param $obj
* @param $data
*/
public function addData($interpreter)
{
if (is_null($interpreter->getTupleCount())) {
$interpreter->setTupleCount($this->width);
}
$data = $interpreter->processData(function ($tuple) {
$tuple[0] /= 1000;
return $tuple;
});
if (count($data) > 0) {
$xData = $yData = array();
// TODO adjust x-Axis
foreach ($data as $reading) {
$xData[] = $reading[0];
$yData[] = $reading[1];
}
// Create the scatter plot
$plot = new \LinePlot($yData, $xData);
$plot->setLegend($interpreter->getEntity()->getProperty('title') . ': [' . $interpreter->getEntity()->getDefinition()->getUnit() . ']');
$plot->SetColor($this->colors[$this->count]);
$plot->SetStepStyle($interpreter instanceof Interpreter\MeterInterpreter);
$axis = $this->getAxisIndex($interpreter->getEntity());
if ($axis >= 0) {
$this->graph->AddY($axis, $plot);
} else {
$this->graph->Add($plot);
}
$this->count++;
}
}