本文整理汇总了PHP中LinePlot类的典型用法代码示例。如果您正苦于以下问题:PHP LinePlot类的具体用法?PHP LinePlot怎么用?PHP LinePlot使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LinePlot类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lineChart
public static function lineChart($data1, $data2, $legends)
{
$graph = new Graph(600, 400);
$graph->SetScale('intlin');
$graph->SetShadow();
$graph->SetMargin(40, 20, 20, 40);
// $graph->title->Set('Calls per operator (June,July)');
// $graph->subtitle->Set('(March 12, 2008)');
// $graph->xaxis->title->Set('Operator');
// $graph->yaxis->title->Set('# of calls');
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->SetTickLabels($legends);
$lineplot = new LinePlot($data1);
$lineplot->SetWeight(4);
// Two pixel wide
// Add the plot to the graph
$graph->Add($lineplot);
// Create the second data series
$lineplot2 = new LinePlot($data2);
$lineplot2->SetWeight(4);
// Two pixel wide
$graph->Add($lineplot2);
$lineplot->SetLegend("This Year");
$lineplot2->SetLegend("Last Year");
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->Pos(0.4, 0.95, "center", "bottom");
return $graph->Stroke('../graph/compareLineChart.png');
}
示例2: monthchart
function monthchart($xdata, $ydata, $title = 'Line Chart')
{
// Create the graph. These two calls are always required
$graph = new Graph(600, 250, "auto", 60);
$graph->img->SetAntiAliasing(false);
$graph->SetScale("textlin");
$graph->xaxis->SetTickLabels($xdata);
$graph->xgrid->SetColor('#E3E3E3');
$graph->legend->SetFrameWeight(1);
// Setup title
$graph->title->Set($title);
foreach ($ydata as $item) {
// Create the linear plot
if (count($item['values']) != count($xdata)) {
continue;
}
$lineplot = new LinePlot($item['values'], $xdata);
$lineplot->SetColor($item['color']);
if (count($ydata) == 1) {
$lineplot->SetFillColor($item['color']);
}
// Add the plot to the graph
$graph->Add($lineplot);
$lineplot->SetLegend($item['legend']);
}
return $graph;
}
示例3: graficofecha
public function graficofecha($gestion)
{
if (Conectar::con()) {
//$gestion='2013';
$objetoanalisis = new classAnalisis();
$anio = $gestion;
for ($i = 0; $i < 12; $i++) {
$dat[] = $objetoanalisis->ventamensual($anio, $i);
}
$datos = $dat;
//$datos =array('1','4','3','3','5');
$grafico = new Graph(400, 300, "auto");
$grafico->SetScale("textlin");
$grafico->title->Set("Resumen de ventas por gestion");
$grafico->xaxis->title->Set("");
$grafico->yaxis->title->Set("");
// Un gradiente Horizontal de rojo a azul
// 25 pixeles de ancho para cada barra
$lineplot = new LinePlot($datos);
$lineplot->SetColor("green");
$lineplot->SetWeight(2);
$grafico->Add($lineplot);
return $grafico->Stroke();
}
}
示例4: buildGraph
/**
* @return Chart
*/
public function buildGraph()
{
require_once 'common/chart/Chart.class.php';
if ($this->error == NULL) {
if ($this->width == 0) {
$this->width = count($this->data) * self::WIDTH_PER_POINT + self::MARGIN;
}
if ($this->scale == GraphOnTrackersV5_Chart_CumulativeFlow::SCALE_DAY) {
foreach ($this->data as $date => $label) {
$dates[] = date('M-d', $date);
}
} else {
foreach ($this->data as $date => $label) {
$dates[] = date('M-Y', $date);
}
}
$this->graph = new Chart($this->width, $this->height);
$colors = $this->getColors();
$this->graph->SetScale("datlin");
$this->graph->title->Set($this->title);
$this->graph->xaxis->SetTickLabels($dates);
$this->graph->yaxis->scale->SetAutoMin(0);
if (is_null($this->description)) {
$this->description = "";
}
$this->graph->subtitle->Set($this->description);
$this->keys = array_keys($this->data[$this->start_date]);
$this->nbOpt = count($this->keys);
$this->stackDataCount();
$this->graph->ygrid->SetFill(true, '#F3FFFF@0.5', '#FFFFFF@0.5');
for ($i = $this->nbOpt - 1; $i >= 0; $i--) {
$lineData = array();
foreach ($this->data as $data => $row) {
$lineData[] = $row[$this->keys[$i]];
}
$line = new LinePlot($lineData);
$line->SetFillColor($colors[$this->keys[$i]]);
$line->SetColor('#000');
$line->SetLegend($this->keys[$i]);
$this->graph->Add($line);
}
try {
$legend_line_height = 20;
$graph_margin_bottom = 70;
$margin_size = $this->nbOpt * $legend_line_height + $graph_margin_bottom;
$this->graph->img->SetMargin(70, 30, 30, $margin_size);
} catch (Exception $e) {
// do nothing, JPGraph displays the error by itself
}
$this->graph->legend->SetAbsPos(0, $this->height, 'left', 'bottom');
} else {
$this->graph = $this->error;
}
return $this->graph;
}
示例5: renderGraph
public function renderGraph()
{
require_once 'libs/jpgraph/jpgraph.php';
require_once 'libs/jpgraph/jpgraph_bar.php';
require_once 'libs/jpgraph/jpgraph_line.php';
$graph = new Graph(300, 200, 'auto');
$graph->SetMarginColor('white');
$graph->SetFrame(false);
$graph->SetScale("textlin");
$graph->SetY2Scale("lin");
$graph->img->SetMargin(0, 30, 20, 65);
$graph->yaxis->HideLabels();
$graph->yaxis->HideTicks();
$graph->yaxis->scale->SetGrace(20);
$graph->y2axis->SetColor("black", "red");
$graph->ygrid->SetFill(true, '#EFEFEF@0.5', '#BBCCFF@0.5');
$labelsy = array();
$datay = array();
$datay2 = array();
switch ($this->_controllerAction->getRequest()->getParam('type')) {
case 'year':
$this->_populateYearData($labelsy, $datay, $datay2);
break;
default:
$this->_populateWeekData($labelsy, $datay, $datay2);
}
$graph->xaxis->SetTickLabels($labelsy);
$locale = Zend_Registry::get('Zend_Locale');
if ($locale == 'ja') {
// the ttf file for FF_MINCHO is already encoded in utf-8
$legend1 = $this->view->translate('Trusted sites');
$legend2 = $this->view->translate('Sites per user');
} else {
// default ttf files are latin-1 encoded
$legend1 = utf8_decode($this->view->translate('Trusted sites'));
$legend2 = utf8_decode($this->view->translate('Sites per user'));
}
$bplot = new BarPlot($datay);
$bplot->setLegend($legend1);
$bplot->SetFillGradient("navy", "lightsteelblue", GRAD_WIDE_MIDVER);
$bplot->value->Show();
$bplot->value->SetFormat('%d');
$p1 = new LinePlot($datay2);
$p1->SetColor("red");
$p1->SetLegend($legend2);
$graph->Add($bplot);
$graph->AddY2($p1);
$graph->legend->SetLayout(LEGEND_HOR);
if ($locale == 'ja') {
$graph->legend->setFont(FF_MINCHO, FS_NORMAL);
}
$graph->legend->Pos(0.5, 0.99, "center", "bottom");
$graph->Stroke();
}
示例6: 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);
}
}
示例7: process
function process()
{
parent::process();
$this->setPmvTitle($this->graph);
$this->setPmvBackgroundGradient($this->graph);
/**
* group (bar + line)
*/
$group = new PlotGroup();
$this->setPmvGroupProperties($group);
$group->axis->right->setColor(new Red());
$group->axis->right->label->setFont(new Font2());
/**
* line
*/
$plot = new LinePlot($this->y2, LINEPLOT_MIDDLE);
$plot->setColor(new Red());
$plot->setThickness(1);
$plot->setYAxis(PLOT_RIGHT);
$group->legend->add($plot, $this->y2Legend, LEGEND_MARK);
$group->add($plot);
/**
* vertical bar
*/
$plot = new BarPlot($this->y1);
$plot->grid->setType(LINE_DASHED);
$this->setPmvPadding($plot);
$this->setPmvBackgroundGradient($plot);
$this->setPmvBarBorderProperties($plot);
$this->setPmvBarShadowProperties($plot);
$this->setPmvLabelProperties($plot, $this->y1);
$this->setPmvBarGradient($plot);
$this->setPmvBarSize($plot);
//$plot->xAxis->setColor( new Color( 50, 97, 243) );
//$plot->yAxis->setColor( new Color( 50, 97, 243) );
//$plot->xAxis->label->setFont($this->font20);
$group->axis->bottom->setLabelText($this->x);
$group->axis->bottom->setPadding(0, 0, 100, 0);
// display one axis label on two because too long for Mar 04 Apr 04 etc.
if (isset($this->interval)) {
$group->axis->bottom->label->setInterval(2);
}
$group->legend->add($plot, $this->y1Legend, LEGEND_BACKGROUND);
$group->add($plot);
/**
* add group to graph
*/
$this->graph->add($group);
}
示例8: LineGraph
function LineGraph($w, $h, $title, $data1, $data2, $datax, $output)
{
// Create the graph. These two calls are always required
$graph = new Graph($w, $h, "auto");
$graph->SetScale("textlin");
$graph->SetMarginColor('white');
$graph->SetFrame(true);
// Adjust the margin
$graph->img->SetMargin(40, 100, 20, 40);
$graph->SetShadow(false);
// Create the linear plot
$lineplot = new LinePlot($data1);
$lineplot->SetWeight(2);
$lineplot->SetColor("blue");
$lineplot->mark->SetType(MARK_DIAMOND);
$lineplot->mark->SetWidth(5);
$lineplot->mark->SetFillColor('blue');
$lineplot->value->SetMargin(-20);
$lineplot->value->show();
$lineplot->value->SetColor('blue');
$lineplot->value->SetFormat('%0.0f');
$lineplot->SetLegend($_SESSION[Tahun1]);
$lineplot2 = new LinePlot($data2);
$lineplot2->SetColor("green");
$lineplot2->SetWeight(2);
$lineplot2->mark->SetType(MARK_FILLEDCIRCLE);
$lineplot2->mark->SetWidth(3);
$lineplot2->mark->SetFillColor('green');
$lineplot2->value->show();
$lineplot2->value->SetColor('darkgreen');
$lineplot2->value->SetFormat('%0.0f');
$lineplot2->SetLegend($_SESSION[Tahun2]);
// Add the plot to the graph
$graph->Add($lineplot);
$graph->xaxis->SetTickLabels($datax);
$graph->title->Set($title);
$graph->xaxis->title->Set("");
$graph->yaxis->title->Set("");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->Add($lineplot2);
$graph->legend->SetShadow(false);
$graph->legend->SetFillColor('white');
$graph->legend->SetPos(0.01, 0.88, 'right', 'center');
// Display the graph
$graph->Stroke($output);
}
示例9: linechart
function linechart($ydata, $title = 'Line Chart')
{
require_once APPPATH . 'third_party/jpgraph-3.5.0b1/src/jpgraph.php';
require_once APPPATH . 'third_party/jpgraph-3.5.0b1/src/jpgraph_line.php';
// Create the graph. These two calls are always required
$graph = new Graph(350, 250, "auto", 60);
$graph->SetScale("textlin");
// Setup title
$graph->title->Set($title);
// Create the linear plot
$lineplot = new LinePlot($ydata);
$lineplot->SetColor("blue");
// Add the plot to the graph
$graph->Add($lineplot);
return $graph;
// does PHP5 return a reference automatically?
}
示例10: AudiogrammeTonal
function AudiogrammeTonal($with_legend = true)
{
$frequences = CExamAudio::$frequences;
$delta = $with_legend ? 75 : 0;
// Setup the graph.
$this->Graph(300 + $delta, 250, "auto");
$this->SetScale("textlin", -120, 10);
$this->SetMarginColor("lightblue");
// Image setup
//$this->img->SetAntiAliasing();
$this->img->SetMargin(45, 20 + $delta, 30, 15);
// Legend setup
if ($with_legend) {
$this->legend->Pos(0.02, 0.5, "right", "center");
$this->legend->SetShadow("darkgray@0.5", 3);
$this->legend->SetFont(FF_ARIAL, FS_NORMAL, 7);
$this->legend->SetFillColor('white@0.3');
} else {
$this->legend->Hide();
}
// Title setup
$this->title->SetFont(FF_ARIAL, FS_NORMAL, 10);
$this->title->SetColor("darkred");
//Setup X-axis labels
$this->xgrid->Show(true);
$this->xgrid->SetColor("lightgray", "lightgray:1.8");
$this->xaxis->SetFont(FF_ARIAL, FS_NORMAL, 8);
$this->xaxis->SetTickLabels($frequences);
$this->xaxis->SetLabelSide(1);
$this->xaxis->SetLabelMargin(22);
// Setup Y-axis labels
$this->ygrid->Show(true, true);
$this->ygrid->SetColor("lightgray", "lightgray:1.8");
$this->yaxis->SetFont(FF_ARIAL, FS_NORMAL, 8);
$this->yaxis->SetLabelFormatString("%ddB");
$this->yaxis->scale->ticks->Set(20, 10);
$this->yaxis->scale->ticks->SupressZeroLabel(false);
$this->yaxis->scale->ticks->SupressMinorTickMarks(false);
// Empty plots for scale window
foreach ($frequences as $value) {
$datay[] = 100;
}
$p1 = new LinePlot($datay);
$p1->SetCenter();
$this->Add($p1);
}
示例11: create
public function create()
{
$legend = $this->getArg('legend');
$y = $this->getArg('y');
if ($y === NULL) {
awImage::drawError("Class LightLinePattern: Argument 'y' must not be NULL.");
}
$plot = new LinePlot($y);
$plot->setSize(0.7, 1);
$plot->setCenter(0.35, 0.5);
$plot->setPadding(35, 15, 35, 30);
$plot->setColor(new Orange());
$plot->setFillColor(new LightOrange(80));
$plot->grid->setType(Line::DASHED);
$plot->mark->setType(Mark::CIRCLE);
$plot->mark->setFill(new MidRed());
$plot->mark->setSize(6);
$plot->legend->setPosition(1, 0.5);
$plot->legend->setAlign(Legend::LEFT);
$plot->legend->shadow->smooth(TRUE);
if ($legend !== NULL) {
$plot->legend->add($plot, $legend, Legend::MARK);
}
return $plot;
}
示例12: createSpline
function createSpline($ydata = "")
{
$xdata = array(2, 4, 6, 8, 10, 12, 14, 16);
if (!$ydata) {
$ydata = array(5, 1, 9, 6, 4, 3, 4, 2);
}
// Get the interpolated values by creating
// a new Spline object.
$spline = new Spline($xdata, $ydata);
// For the new data set we want 40 points to
// get a smooth curve.
list($newx, $newy) = $spline->Get(50);
// Create the graph
$g = new Graph(380, 300);
$g->SetMargin(30, 20, 40, 30);
//$g->title->Set("Natural cubic splines");
//$g->title->SetFont(FF_ARIAL,FS_NORMAL,12);
//$g->subtitle->Set('(Control points shown in red)');
//$g->subtitle->SetColor('darkred');
$g->SetMarginColor('lightblue');
//$g->img->SetAntiAliasing();
// We need a linlin scale since we provide both
// x and y coordinates for the data points.
$g->SetScale('linlin');
$xlable = array('', 'AA', 'AA', 'AB', 'AB', 'BB', 'BB', 'BC', 'BC', 'CC', 'CC', 'CD', 'CD', 'DD', 'DD', 'FF', 'FF', '');
// We want 1 decimal for the X-label
//$g -> xaxis -> SetLabelFormat('%d');
$g->xaxis->SetTickLabels($xlable);
// We use a scatterplot to illustrate the original
// contro points.
$splot = new ScatterPlot($ydata, $xdata);
//
$splot->mark->SetFillColor('red@0.3');
$splot->mark->SetColor('red@0.5');
// And a line plot to stroke the smooth curve we got
// from the original control points
$lplot = new LinePlot($newy, $newx);
$lplot->SetColor('navy');
// Add the plots to the graph and stroke
$g->Add($lplot);
$g->Add($splot);
$g->Stroke();
}
示例13: draw_graph
function draw_graph($datay, $data2y, $label_x)
{
include_once "src/jpgraph.php";
include_once "src/jpgraph_line.php";
// A nice graph with anti-aliasing
$graph = new Graph(800, 600, "auto");
$graph->img->SetMargin(40, 180, 40, 40);
$graph->img->SetAntiAliasing("white");
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->title->Set("Nodes and Comment Count By Duration");
$graph->xaxis->SetTickLabels($label_x);
// Use built in font
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Slightly adjust the legend from it's default position in the
// top right corner.
$graph->legend->Pos(0.05, 0.5, "right", "center");
// Create the first line
if ($datay) {
$p1 = new LinePlot($datay);
$p1->mark->SetType(MARK_FILLEDCIRCLE);
$p1->mark->SetFillColor("blue");
$p1->mark->SetWidth(4);
$p1->SetColor("blue");
$p1->SetCenter();
$p1->SetLegend("Nodes Count");
$graph->Add($p1);
}
// ... and the second
if ($data2y) {
$p2 = new LinePlot($data2y);
$p2->mark->SetType(MARK_STAR);
$p2->mark->SetFillColor("red");
$p2->mark->SetWidth(4);
$p2->SetColor("red");
$p2->SetCenter();
$p2->SetLegend("Comments Count");
$graph->Add($p2);
}
// Output line
$graph->Stroke();
}
示例14: plot
function plot()
{
$this->_setValues();
$graph = new Graph(380, 250);
$graph->img->SetMargin(50, 30, 40, 40);
$graph->SetShadow();
$graph->SetColor("lightyellow");
$graph->SetScale("textlin");
$graph->title->Set($this->_graphTitle);
$graph->yaxis->SetColor("blue");
$graph->xaxis->SetColor("blue");
$graph->title->SetFont(FONT1_BOLD);
$graph->xaxis->SetTickLabels($this->_xaxisValues);
$lineplot = new LinePlot($this->_yaxisValues);
$lineplot->SetColor("red");
// Add the plot to the graph
$graph->Add($lineplot);
// Display the graph
$graph->Stroke();
}
示例15: buildGraph
/**
* @return Chart
*/
public function buildGraph()
{
$graph = new Chart($this->width, $this->height);
$graph->SetScale("datlin");
$graph->title->Set($this->title);
$graph->subtitle->Set($this->description);
$colors = $graph->getThemedColors();
$graph->xaxis->SetTickLabels($this->burndown_data->getHumanReadableDates());
$remaining_effort = new LinePlot($this->burndown_data->getRemainingEffort());
$remaining_effort->SetColor($colors[1] . ':0.7');
$remaining_effort->SetWeight(2);
$remaining_effort->SetLegend('Remaining effort');
$remaining_effort->mark->SetType(MARK_FILLEDCIRCLE);
$remaining_effort->mark->SetColor($colors[1] . ':0.7');
$remaining_effort->mark->SetFillColor($colors[1]);
$remaining_effort->mark->SetSize(3);
$graph->Add($remaining_effort);
$ideal_burndown = new LinePlot($this->burndown_data->getIdealEffort());
$ideal_burndown->SetColor($colors[0] . ':1.25');
$ideal_burndown->SetLegend('Ideal Burndown');
$graph->Add($ideal_burndown);
return $graph;
}