本文整理汇总了PHP中Graph::AddY2方法的典型用法代码示例。如果您正苦于以下问题:PHP Graph::AddY2方法的具体用法?PHP Graph::AddY2怎么用?PHP Graph::AddY2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph::AddY2方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: summary
/**
*
*/
public function summary($id)
{
$iterationAux;
//try {
$project = Project::findOrFail($id);
$iterations = Iterations::where('projectid', '=', $id)->get();
//foreach($iterations as $var){
// $iterationAux = $iterationAux . var_dump($var);
//}
//}catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
//}
//die;
JpGraph\JpGraph::load();
JpGraph\JpGraph::module('bar');
JpGraph\JpGraph::module('line');
$datay = array(20, 30, 50, 80);
$datay2 = array(30, 95, 70, 40);
$datazero = array(0, 0, 0, 0);
// Create the graph.
$graph = new Graph(800, 500);
$graph->title->Set('Example with 2 scale bars : ' . $project->name . ' : ' . $id . ' : ' . sizeof($iterations));
// Setup Y and Y2 scales with some "grace"
$graph->SetScale("textlin");
$graph->SetY2Scale("lin");
//$graph->yaxis->scale->SetGrace(30);
//$graph->y2axis->scale->SetGrace(30);
//$graph->ygrid->Show(true,true);
$graph->ygrid->SetColor('gray', 'lightgray@0.5');
// Setup graph colors
$graph->SetMarginColor('white');
$graph->y2axis->SetColor('darkred');
// Create the "dummy" 0 bplot
$bplotzero = new BarPlot($datazero);
// Create the "Y" axis group
$ybplot1 = new BarPlot($datay);
$ybplot1->value->Show();
$ybplot = new GroupBarPlot(array($ybplot1, $bplotzero));
// Create the "Y2" axis group
$ybplot2 = new BarPlot($datay2);
$ybplot2->value->Show();
$ybplot2->value->SetColor('darkred');
$ybplot2->SetFillColor('darkred');
$y2bplot = new GroupBarPlot(array($bplotzero, $ybplot2));
// Add the grouped bar plots to the graph
$graph->Add($ybplot);
$graph->AddY2($y2bplot);
$datax = array('A', 'B', 'C', 'D');
$graph->xaxis->SetTickLabels($datax);
// .. and finally stroke the image back to browser
$graph->Stroke();
}
示例3: LinePlot
$graph->title->Set("Inverting both Y-axis");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->title->SetColor("white");
$graph->subtitle->Set("(Negated Y & Y2 axis)");
$graph->subtitle->SetFont(FF_FONT1, FS_NORMAL);
$graph->subtitle->SetColor("white");
// Setup axis
$graph->yaxis->SetLabelFormatCallback("_cb_negate");
$graph->xaxis->SetColor("lightblue", "white");
$graph->yaxis->SetColor("lightblue", "white");
$graph->ygrid->SetColor("blue");
// Setup Y2 axis
$graph->y2axis->SetLabelFormatCallback("_cb_negate");
$graph->y2axis->SetColor("darkred", "white");
$graph->y2scale->SetAutoMax(0);
// To make sure it starts with 0
// Setup plot 1
$lp1 = new LinePlot($ydata);
$lp1->SetColor("yellow");
$lp1->SetWeight(2);
$graph->Add($lp1);
// Setup plot 2
$lp2 = new LinePlot($y2data);
$lp2->SetColor("darkred");
$lp2->SetWeight(2);
$graph->AddY2($lp2);
$graph->Stroke();
?>
示例4: draw_bp
function draw_bp($actual, $graph_details)
{
$w = 700;
$h = 450;
$arr_xlabel = array();
$arr_diastolic = array();
$arr_systolic = array();
$arr_status = array();
//print_r($actual);
foreach ($actual as $key => $value) {
array_push($arr_xlabel, $value[0]);
array_push($arr_diastolic, $value[1]);
array_push($arr_systolic, $value[2]);
array_push($arr_status, $value[3]);
}
$graph = new Graph($w, $h);
$graph->SetScale('intlin');
$graph->SetY2Scale('int', 0, 200);
$graph->SetMargin(40, 70, 40, 60);
$graph->title->Set($graph_details[0] . ' of ' . get_px_name());
$graph->xaxis->title->Set($graph_details[1]);
$graph->yaxis->title->Set($graph_details[2]);
$graph->xaxis->SetTickLabels($arr_xlabel);
$lineplot = new LinePlot($arr_diastolic);
$lineplot2 = new LinePlot($arr_systolic);
$lineplot->SetColor('blue');
$lineplot->SetWeight(2);
$lineplot2->SetColor('red');
$lineplot2->SetWeight(2);
$lineplot->value->Show();
$lineplot2->value->Show();
$graph->Add($lineplot);
$graph->AddY2($lineplot2);
$lineplot->SetLegend('Systolic');
$lineplot2->SetLegend('Diastolic');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->Pos(0.5, 0.99, 'center', 'bottom');
$graph->Stroke();
}
示例5: LinePlot
$lineplot2 = new LinePlot($ydata2);
$lineplot2->SetColor("green");
$lineplot3 = new LinePlot($ydata3);
$lineplot3->SetColor("orange");
$lineplot4 = new LinePlot($ydata4);
$lineplot4->SetColor("navy");
$lineplot5 = new LinePlot($ydata5);
$lineplot5->SetColor("red");
$lineplot5->SetWeight(2);
$lineplot5->mark->SetType(MARK_IMG_STAR, "blue", 0.7);
// Add the plot to the graph
$graph->Add($lineplot);
$graph->Add($lineplot2);
$graph->Add($lineplot3);
//$graph->Add($lineplot4);
$graph->AddY2($lineplot5);
$graph->y2axis->SetColor("red");
// Afficher les données sur la ligne des blanchissages.
$lineplot4->value->SetFormat("%d");
$lineplot4->value->show();
// Afficher les données sur la ligne Moy/pj
$lineplot5->value->SetFormat("%1.2f");
$lineplot5->value->show();
// Set the legends for the plots
$lineplot->SetLegend("Pts");
$lineplot2->SetLegend("Vict.");
$lineplot3->SetLegend("Parties");
//$lineplot4->SetLegend("Blanch.");
$lineplot5->SetLegend("Moy/pj");
// Adjust the legend position
$graph->legend->Pos(0.05, 0.5, "right", "center");
示例6: LinePlot
// Setup the scales for X,Y and Y2 axis
$graph->SetScale("intlin");
// X and Y axis
$graph->SetY2Scale("lin");
// Y2 axis
// Overall graph title
$graph->title->Set('Synchronized Y & Y2 scales');
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 12);
// Title for X-axis
$graph->xaxis->title->Set('Measurement');
$graph->xaxis->title->SetMargin(5);
$graph->xaxis->title->SetFont(FF_ARIAL, FS_NORMAL, 11);
// Create Y data set
$lplot = new LinePlot($datay);
$graph->yaxis->title->Set('Celcius (C)');
$graph->yaxis->title->SetMargin(5);
$graph->yaxis->title->SetFont(FF_ARIAL, FS_NORMAL, 11);
// ... and add the plot to the Y-axis
$graph->Add($lplot);
// Create Y2 scale data set
$l2plot = new LinePlot($datay);
$l2plot->SetWeight(0);
$graph->y2axis->title->Set('Fahrenheit (F)');
$graph->y2axis->title->SetMargin(5);
// Some extra margin to clear labels
$graph->y2axis->title->SetFont(FF_ARIAL, FS_NORMAL, 11);
$graph->y2axis->SetLabelFormatCallback('toFahrenheit');
$graph->y2axis->SetColor('navy');
// ... and add the plot to the Y2-axis
$graph->AddY2($l2plot);
$graph->Stroke();
示例7: BarPlot
$graph->yaxis->SetTickSide(SIDE_LEFT);
$graph->y2axis->SetTickSide(SIDE_RIGHT);
$graph->y2axis->SetColor('black', 'blue');
$graph->y2axis->SetLabelFormat('%3d.0%%');
// Create a bar pot
$bplot = new BarPlot($data_freq);
// Create targets and alt texts for the image maps. One for each bar
// (In this example this is just "dummy" targets)
$targ = array("#1", "#2", "#3", "#4", "#5", "#6", "#7");
$alts = array("val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d");
$bplot->SetCSIMTargets($targ, $alts);
// Create accumulative graph
$lplot = new LinePlot($data_accfreq);
// We want the line plot data point in the middle of the bars
$lplot->SetBarCenter();
// Use transperancy
$lplot->SetFillColor('lightblue@0.6');
$lplot->SetColor('blue@0.6');
//$lplot->SetColor('blue');
$graph->AddY2($lplot);
// Setup the bars
$bplot->SetFillColor("orange@0.2");
$bplot->SetValuePos('center');
$bplot->value->SetFormat("%d");
$bplot->value->SetFont(FF_ARIAL, FS_NORMAL, 9);
$bplot->value->Show();
// Add it to the graph
$graph->Add($bplot);
// Send back the HTML page which will call this script again
// to retrieve the image.
$graph->StrokeCSIM();
示例8: array
$x = array($clientrawextra['459'], $clientrawextra['460'], $clientrawextra['461'], $clientrawextra['462'], $clientrawextra['463'], $clientrawextra['464'], $clientrawextra['465'], $clientrawextra['466'], $clientrawextra['467'], $clientrawextra['468'], $clientrawextra['469'], $clientrawextra['470'], $clientrawextra['471'], $clientrawextra['472'], $clientrawextra['473'], $clientrawextra['474'], $clientrawextra['475'], $clientrawextra['476'], $clientrawextra['477'], $clientrawextra['478'], $clientrawextra['578'], $clientrawextra['579'], $clientrawextra['580'], $clientrawextra['581']);
$datax = $x;
// Create the graph and specify the scale for both Y-axis
$graph = new Graph($xsize, $ysize, "auto", 30);
$graph->SetScale("textlin");
$graph->SetY2Scale("lin", 0, 100);
$graph->SetShadow();
$graph->SetMarginColor("{$margincolour}");
// Adjust the margin
$graph->SetMargin($lm, $rm, $tm, $bm);
// Create the two linear plot
$lplot = new LinePlot($ydata);
$lplot2 = new LinePlot($y2data);
// Add the plot to the graph
$graph->Add($lplot);
$graph->AddY2($lplot2);
$lplot->SetWeight(2);
$lplot2->SetWeight(2);
//titles
$graph->title->Set("{$txt_temp} - {$txt_hum} {$txt_24h}");
$graph->title->Align("left", "top");
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 10);
$graph->title->SetColor("{$textcolour}");
//x-axis
$graph->xaxis->title->SetFont(FF_ARIAL, FS_BOLD, 8);
$graph->xaxis->SetFont(FF_ARIAL, FS_BOLD, 8);
$graph->xaxis->SetTitlemargin(25);
$graph->xaxis->SetLabelMargin(10);
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetLabelAngle($label_angle);
$graph->xaxis->SetTextLabelInterval($label_interval);
示例9: GroupBarPlot
$ybplot1->value->SetMargin(5);
$ybplot1->value->SetAngle(60);
//$ybplot1->SetFormt('$%01.2f');
$ybplot1->SetFillGradient("#408CFF", "#F0F0FF", GRAD_HOR);
$ybplot = new GroupBarPlot(array($ybplot1, $bplotzero));
// Setup font for axis
//Bottom Lables
$graph->xaxis->SetFont(FF_GEORGIA, FS_NORMAL, 10);
$graph->xaxis->SetColor("#1B1B1B");
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetLabelAngle(50);
//Left Lables
$graph->yaxis->SetFont(FF_GEORGIA, FS_NORMAL, 10);
$graph->yaxis->SetColor('#1B1B1B');
//$graph->y2axis->SetFont(FF_VERDANA,FS_NORMAL,10);
// Create the "Y2" axis group
$ybplot2 = new BarPlot($datay);
$ybplot2->value->Show();
$ybplot2->value->SetColor('#008000');
$ybplot2->value->SetFont(FF_ARIAL, FS_NORMAL, 8);
$ybplot2->value->SetMargin(0);
$ybplot2->value->SetAngle(60);
//$ybplot2->value->SetFormt('$%01.2f');
$ybplot2->SetFillGradient("#80FF80", "#E8FFE8", GRAD_HOR);
$y2bplot = new GroupBarPlot(array($bplotzero, $ybplot2));
// Setup X-axis labels
// Add the grouped bar plots to the graph
$graph->Add($ybplot);
$graph->AddY2($y2bplot);
// .. and finally stroke the image back to browser
$graph->Stroke();
示例10: array
require_once "jpgraph/jpgraph.php";
require_once "jpgraph/jpgraph_line.php";
$ydata = array(11, 3, 8, 12, 5, 1, 9, 13, 5, 7);
$y2data = array(354, 200, 265, 99, 111, 91, 198, 225, 293, 251);
$graph = new Graph(350, 300);
$graph->SetAngle(40);
$graph->img->SetMargin(80, 80, 80, 80);
$graph->SetScale("textlin");
$graph->SetY2Scale("lin");
$graph->SetShadow();
// Create the linear plot
$lineplot = new LinePlot($ydata);
$lineplot2 = new LinePlot($y2data);
// Add the plot to the graph
$graph->Add($lineplot);
$graph->AddY2($lineplot2);
$lineplot2->SetColor("orange");
$lineplot2->SetWeight(2);
$graph->y2axis->SetColor("orange");
$graph->title->Set("Example 1 rotated graph (40 degree)");
$graph->legend->Pos(0.05, 0.1, "right", "top");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
$lineplot->SetColor("blue");
$lineplot->SetWeight(2);
$lineplot2->SetColor("orange");
$lineplot2->SetWeight(2);
$graph->yaxis->SetColor("blue");
$lineplot->SetLegend("Plot 1");
$lineplot2->SetLegend("Plot 2");
示例11: LinePlot
$graph->legend->Pos(0.1, 0.06, "right", "top");
// Create the linear plot
$lineplot = new LinePlot($soil, $times);
$graph->Add($lineplot);
$lineplot->SetColor("blue");
$lineplot->SetWeight(3);
$lineplot->SetLegend("4in Soil Temp");
// Create the linear plot
$lineplot4 = new LinePlot($c_soil, $times);
$graph->Add($lineplot4);
$lineplot4->SetColor("purple");
$lineplot4->SetStyle("dashed");
$lineplot4->SetWeight(2);
$lineplot4->SetLegend("4in Soil Temp Climate");
$bp2 = new BarPlot($srad, $times);
$graph->AddY2($bp2);
$bp2->SetFillColor("pink");
$bp2->SetWidth(4.0);
$bp2->SetLegend("Solar Rad");
// Create the linear plot
$lineplot3 = new LinePlot($c_srad, $times);
$graph->AddY2($lineplot3);
$lineplot3->SetColor("red");
$lineplot3->SetWeight(2);
$lineplot3->SetStyle("dashed");
$lineplot3->SetLegend("Solar Rad Climate");
// Display the graph
$graph->Stroke();
?>
示例12: LinePlot
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetPos(0.01, 0.9399999999999999, 'left', 'top');
$graph->legend->SetLineSpacing(3);
$graph->ygrid->SetFill(true, '#EFEFEF@0.5', '#BBCCEE@0.5');
$graph->ygrid->Show();
$graph->xgrid->Show();
$graph->yaxis->scale->ticks->SetLabelFormat("%5.1f");
$graph->yaxis->scale->ticks->SetLabelFormat("%5.0f");
$graph->y2axis->scale->ticks->Set(100, 25);
$graph->y2axis->scale->ticks->SetLabelFormat("%-4.0f");
// Create the linear plot
$lineplot = new LinePlot($temps, $times);
$lineplot->SetLegend("Temperature");
$lineplot->SetColor("red");
//$lineplot->SetWeight(2);
// Create the linear plot
$lineplot2 = new LinePlot($dewps, $times);
$lineplot2->SetLegend("Dew Point");
$lineplot2->SetColor("blue");
//$lineplot2->SetWeight(2);
// Create the linear plot
$lineplot3 = new LinePlot($srad, $times);
$lineplot3->SetLegend("Solar Rad");
$lineplot3->SetColor("black");
//$lineplot3->SetWeight(2);
$graph->Add($lineplot2);
$graph->Add($lineplot);
if ($station != 'SPEI4') {
$graph->AddY2($lineplot3);
}
$graph->Stroke();
示例13:
//$graph->AddText($tx3);
// Add the plot to the graph
$graph->Add($fz);
if (max($tcs0) != "" && isset($_GET["s0"])) {
$graph->Add($lineplot);
}
if (max($tcs1) != "" && isset($_GET["s1"])) {
$graph->Add($lineplot2);
}
if (max($tcs2) != "" && isset($_GET["s2"])) {
$graph->Add($lineplot3);
}
if (max($tcs3) != "" && isset($_GET["s3"])) {
$graph->Add($lineplot4);
}
if (max($Asubc) != "" && isset($_GET["subc"])) {
$graph->Add($lineplot5);
}
if (max($Atmpf) != "" && isset($_GET["tmpf"])) {
$graph->Add($lineplot6);
}
if (max($Adwpf) != "" && isset($_GET["dwpf"])) {
$graph->Add($lineplot7);
}
if (max($pcpn) != "" && isset($_GET["pcpn"])) {
$graph->AddY2($bp1);
}
$graph->Stroke();
?>
示例14: LinePlot
$graph->y2axis->scale->SetGrace(10, 0);
$graph->y2axis->SetColor("darkgreen");
$lineCaches = new LinePlot($yDataCaches, $xDate);
$lineCaches->SetLegend(tr("graph_statistics_02"));
$lineCaches->SetColor("blue");
$lineCaches->SetStyle("solid");
$lineCaches->SetWeight(3);
$lineCaches->SetStepStyle();
$graph->Add($lineCaches);
$lineFound = new LinePlot($yDataLogs, $xDate);
$lineFound->SetLegend(tr("graph_statistics_03"));
$lineFound->SetColor("darkgreen");
$lineFound->SetStyle("solid");
$lineFound->SetWeight(2);
$lineFound->SetStepStyle();
$graph->AddY2($lineFound);
//
// Infotexte einfuegen
//
$txtStat1 = new Text(tr('graph_statistics_04') . strftime('%d-%m-%Y', time()));
$txtStat1->SetPos(55, 55);
$txtStat1->SetFont(FF_ARIAL, FS_NORMAL, 10);
$lineHeight = $txtStat1->GetFontHeight($graph->img);
$hiddenCaches = XDb::xSimpleQueryValue("SELECT COUNT(*) FROM `caches` WHERE (`status`=1 OR `status`=2 OR `status`=3)", 0);
$txtStat2 = new Text(tr('graph_statistics_05') . str_replace(',', '.', number_format($hiddenCaches)));
$txtStat2->SetPos(55, 55 + $lineHeight * 1.5);
$txtStat2->SetFont(FF_ARIAL, FS_NORMAL, 8);
$txtStat2->SetColor('blue');
$activeCaches = XDb::xSimpleQueryValue("SELECT COUNT(*) FROM `caches` WHERE `status`=1", 0);
$txtStat3 = new Text(tr('graph_statistics_06') . str_replace(',', '.', number_format($activeCaches)));
$txtStat3->SetPos(55, 55 + $lineHeight * 2.5);
示例15: LinePlot
$graph->tabtitle->SetFont(FF_FONT1, FS_BOLD, 16);
$graph->SetColor('wheat');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetPos(0.01, 0.9399999999999999, 'left', 'top');
$graph->legend->SetLineSpacing(3);
$graph->ygrid->SetFill(true, '#EFEFEF@0.5', '#BBCCEE@0.5');
$graph->ygrid->Show();
$graph->xgrid->Show();
$graph->yaxis->scale->ticks->SetLabelFormat("%5.1f");
$graph->yaxis->scale->ticks->Set(90, 15);
$graph->yaxis->scale->ticks->SetLabelFormat("%5.0f");
$graph->yaxis->scale->ticks->SetLabelFormat("%5.0f");
$graph->yaxis->SetColor("blue");
$graph->yaxis->SetTitle("Wind Direction [N=0, E=90, S=180, W=270]");
// Create the linear plot
$lineplot = new LinePlot($smph, $times);
$lineplot->SetLegend($wLabel);
$lineplot->SetColor("red");
$lp1 = new LinePlot($gust, $times);
$lp1->SetLegend("Peak Wind Gust");
$lp1->SetColor("black");
// Create the linear plot
$sp1 = new ScatterPlot($drct, $times);
$sp1->mark->SetType(MARK_FILLEDCIRCLE);
$sp1->mark->SetFillColor("blue");
$sp1->mark->SetWidth(3);
$sp1->SetLegend("Wind Direction");
$graph->Add($sp1);
$graph->AddY2($lineplot);
$graph->AddY2($lp1);
$graph->Stroke();