本文整理汇总了PHP中LinePlot::SetColor方法的典型用法代码示例。如果您正苦于以下问题:PHP LinePlot::SetColor方法的具体用法?PHP LinePlot::SetColor怎么用?PHP LinePlot::SetColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinePlot
的用法示例。
在下文中一共展示了LinePlot::SetColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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();
}
}
示例3: 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;
}
示例4: 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();
}
示例5: 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);
}
示例6: 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?
}
示例7: 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();
}
示例8: 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();
}
示例9: 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();
}
示例10: 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;
}
示例11: Graph
//
$graph = new Graph(400, 200);
//
// We use an integer scale on the X-axis since the positions on the X axis
// are assumed to be UNI timestamps
$graph->SetScale('intlin', 0, 0, $xmin, $xmax);
$graph->title->Set('Basic example with manual ticks');
$graph->title->SetFont(FF_ARIAL, FS_NORMAL, 12);
//
// Make sure that the X-axis is always at the bottom of the scale
// (By default the X-axis is alwys positioned at Y=0 so if the scale
// doesn't happen to include 0 the axis will not be shown)
$graph->xaxis->SetPos('min');
// Now set the tic positions
$graph->xaxis->SetTickPositions($tickPositions, $minTickPositions);
// The labels should be formatted at dates with "Year-month"
$graph->xaxis->SetLabelFormatString('My', true);
// Use Ariel font
$graph->xaxis->SetFont(FF_ARIAL, FS_NORMAL, 9);
// Add a X-grid
$graph->xgrid->Show();
// Create the plot line
$p1 = new LinePlot($datay, $datax);
$p1->SetColor('teal');
$graph->Add($p1);
// Output graph
$graph->Stroke();
?>
示例12: array
<?php
include "../jpgraph.php";
include "../jpgraph_line.php";
$ydata = array(12, 17, 22, 19, 5, 15);
$graph = new Graph(270, 170);
$graph->SetMargin(30, 90, 30, 30);
$graph->SetScale("textlin");
$graph->img->SetAngle(90);
$graph->img->SetCenter(floor(270 / 2), floor(170 / 2));
$line = new LinePlot($ydata);
$line->SetLegend('2002');
$line->SetColor('darkred');
$line->SetWeight(2);
$graph->Add($line);
// Output graph
$graph->Stroke();
?>
示例13: LinePlot
// Use built in font
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Make the margin around the plot a little bit bigger
// then default
$graph->img->SetMargin(40, 140, 40, 80);
// Slightly adjust the legend from it's default position in the
// top right corner to middle right side
$graph->legend->Pos(0.05, 0.5, "right", "center");
// Display every 10:th datalabel
$graph->xaxis->SetTextTickInterval(6);
$graph->xaxis->SetTextLabelInterval(2);
$graph->xaxis->SetTickLabels($databarx);
$graph->xaxis->SetLabelAngle(90);
// Create a red line plot
$p1 = new LinePlot($datay);
$p1->SetColor("red");
$p1->SetLegend("Pressure");
// Create the bar plot
$b1 = new BarPlot($databary);
$b1->SetLegend("Temperature");
$b1->SetAbsWidth(6);
$b1->SetShadow();
// The order the plots are added determines who's ontop
$graph->Add($p1);
$graph->Add($b1);
// Finally output the image
$graph->Stroke();
?>
示例14: Create
function Create(MASK $mask = NULL, INTERVAL $iv = NULL)
{
global $GRAPH_MARGINS;
global $GRAPH_DENSITY_PLOT_VALID_SIZE;
global $GRAPH_DENSITY_PLOT_VALID_COLOR;
global $GRAPH_DENSITY_PLOT_INVALID_SIZE;
global $GRAPH_DENSITY_PLOT_INVALID_COLOR;
global $GRAPH_DENSITY_POINTS_TYPE;
global $GRAPH_DENSITY_POINTS_SIZE;
global $GRAPH_DENSITY_POINTS_COLOR;
global $GRAPH_DENSITY_POINTS_OUTLINE;
global $JPGRAPH_VERSION;
if ($this->ready) {
return;
}
list($axes, $data, $spec) = $this->PrepareData($this->reader, $mask, $iv);
$draw_modes = array();
foreach ($data as $info) {
$items = $info['items'];
foreach ($items as $item) {
array_push($draw_modes, $item['draw_mode']);
}
}
$this->plot_mode = $this->FindPlotMode($this->req->props['plot_mode']);
$this->AnalyzeGapsRequirements($axes, $data, $spec);
$this->AnalyzeMarksRequirements($axes, $data, $spec);
list($xaxis, $yaxis) = $this->ConfigureAxis($axes, $iv, $data, $spec);
$this->spec =& $spec;
$this->graph = new Graph($this->width, $this->height, "auto");
$this->graph->SetTickDensity(TICKD_SPARSE, TICKD_SPARSE);
if ($xaxis['date_format']) {
$this->graph->SetScale("datlin", 0, 1, $xaxis['from'], $xaxis['to']);
//$this->graph->xaxis->scale->Update($this->graph, $xaxis['from'], $xaxis['to']);
$this->graph->xaxis->scale->SetDateFormat($xaxis['date_format']);
} else {
$this->graph->SetScale("linlin", 0, 1, $xaxis['from'], $xaxis['to']);
if ($xaxis['ticks']) {
$this->graph->xscale->ticks->Set($xaxis['ticks'][0], $xaxis['ticks'][1]);
}
}
if ($xaxis['label_interval']) {
$this->graph->xaxis->SetTextLabelInterval($xaxis['label_interval']);
}
if ($this->hide_axes) {
if (strcasecmp($this->hide_axes, 'Y')) {
$hide_x = true;
} else {
$hide_x = false;
}
$hide_y = true;
} else {
$hide_x = false;
$hide_y = false;
}
$this->graph_margin = array();
if ($hide_y) {
$this->graph_yaxis_size = 0;
if ($hide_x) {
$this->graph_margin[0] = 0;
$this->graph_margin[2] = 0;
} else {
$this->graph_margin[0] = $GRAPH_MARGINS['right'] + $GRAPH_MARGINS['axis'];
$this->graph_margin[2] = $GRAPH_MARGINS['right'];
}
$this->graph->yaxis->HideLabels();
} else {
$this->graph_yaxis_size = $GRAPH_MARGINS['axis'];
$this->graph_margin[0] = $GRAPH_MARGINS['left'] + $this->graph_yaxis_size * $axes->GetAxesNumber();
$this->graph_margin[2] = $GRAPH_MARGINS['right'];
}
if ($hide_x) {
$this->graph_margin[1] = 0;
$this->graph_margin[3] = 1;
$this->graph->xaxis->HideLabels();
} else {
$this->graph_margin[1] = $GRAPH_MARGINS['top'];
$this->graph_margin[3] = $GRAPH_MARGINS['bottom'];
$title = $this->GenerateTitle($data, $spec);
$this->graph->title->Set($title);
$this->graph->xaxis->SetPos("min");
//$this->graph->xaxis->SetLabelAngle(0);
$this->graph->xaxis->SetFont(FF_ARIAL, FS_NORMAL, 8);
//$this->graph->xaxis->scale->SetTimeAlign(MINADJ_15);
// We can use SetLabelFormatCallback for higher control
//$this->graph->yaxis->SetLabelFormat('%0.5g');
//$this->graph->SetYDeltaDist($this->graph_yaxis_size);
}
$this->graph->img->SetMargin($this->graph_margin[0], $this->graph_margin[2], $this->graph_margin[1], $this->graph_margin[3]);
$this->graph->xaxis->SetLabelMargin(13);
foreach ($axes as $axis_i => $axis) {
$empty_axis = true;
if (intval($this->plot_mode) === DRAW::PLOT_STANDARD) {
foreach ($axis as $i => $plot_data) {
$plot = new LinePlot($plot_data[1], $plot_data[0]);
$color = $axis->GetChannelColor($i);
if ($color) {
$plot->SetColor($color);
}
$weight = $axis->GetChannelProperty($i, "weight");
if ($weight) {
//.........这里部分代码省略.........
示例15: ReportUserAdded
$report = new ReportUserAdded($SPAN, $start, $end);
//
// Check for error, such as license key problem
//
if ($report->isError()) {
echo $report->getErrorMessage();
exit;
}
// Some data
$ydata = $report->getData();
// Create the graph. These two calls are always required
$graph = new Graph(640, 480, "auto");
$graph->SetMargin(50, 10, 35, 50);
$graph->SetScale("textlin");
// Create the linear plot
$lineplot = new LinePlot($ydata);
$lineplot->SetColor("black");
$lineplot->SetFillColor("orange");
// Add the plot to the graph
$graph->Add($lineplot);
//$graph->SetMargin(10,10,25,10);
$graph->title->Set("Users Added " . $report->getSpanName() . " (" . date('m/d/Y', $report->getStartDate()) . "-" . date('m/d/Y', $report->getEndDate()) . ")");
$graph->subtitle->Set($sys_name);
//$graph->xaxis-> title->Set("Date" );
//$graph->yaxis-> title->Set("Number" );
$a = $report->getDates();
$graph->xaxis->SetTickLabels($a);
$graph->xaxis->SetLabelAngle(90);
$graph->xaxis->SetTextLabelInterval($report->getGraphInterval());
// Display the graph
$graph->Stroke();