本文整理匯總了PHP中Graph::AddLine方法的典型用法代碼示例。如果您正苦於以下問題:PHP Graph::AddLine方法的具體用法?PHP Graph::AddLine怎麽用?PHP Graph::AddLine使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Graph
的用法示例。
在下文中一共展示了Graph::AddLine方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: BarPlot
$graph->SetShadow();
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 15);
$graph->title->Set("Cash flow ");
$graph->subtitle->Set("(Department X)");
// Show both X and Y grid
$graph->xgrid->Show(true, false);
// Add 10% grace ("space") at top and botton of Y-scale.
$graph->yscale->SetGrace(10, 10);
// Turn the tick mark out from the plot area
$graph->xaxis->SetTickSide(SIDE_DOWN);
$graph->yaxis->SetTickSide(SIDE_LEFT);
// Create a bar pot
$bplot = new BarPlot($datay);
$bplot->SetFillColor("orange");
$bplot->SetShadow();
// Show the actual value for each bar on top/bottom
$bplot->value->Show();
$bplot->value->SetFormat("%02d kr");
// Position the X-axis at the bottom of the plotare
$graph->xaxis->SetPos("min");
// .. and add the plot to the graph
$graph->Add($bplot);
// Add mark graph with static lines
$graph->AddLine(new PlotLine(HORIZONTAL, 0, "black", 2));
$graph->AddLine(new PlotLine(VERTICAL, 3, "black", 2));
//$graph->title->Set("Test of bar gradient fill");
$graph->xaxis->title->Set("X-title");
$graph->yaxis->title->Set("Y-title");
$graph->yaxis->title->SetFont(FF_ARIAL, FS_BOLD, 11);
$graph->xaxis->title->SetFont(FF_ARIAL, FS_BOLD, 11);
$graph->Stroke();
示例2: PlotBand
// .. and add the plot to the graph
$graph->Add($bplot);
// Add upper and lower band and use no frames
$band[0] = new PlotBand(HORIZONTAL, BAND_RDIAG, 10, 20, "green");
$band[0]->ShowFrame(false);
$band[1] = new PlotBand(HORIZONTAL, BAND_LDIAG, -20, -10, "red");
$band[1]->ShowFrame(false);
$band[1]->SetDensity(20);
$band[2] = new PlotBand(HORIZONTAL, BAND_DIAGCROSS, "min", -20, "red");
$band[2]->ShowFrame(false);
$band[2]->SetDensity(40);
$band[3] = new PlotBand(VERTICAL, BAND_HLINE, 0, 1, "darkgray");
$band[3]->ShowFrame(false);
$band[3]->SetOrder(DEPTH_FRONT);
$band[4] = new PlotBand(VERTICAL, BAND_HVCROSS, 5, "max", "darkgray");
$band[4]->ShowFrame(false);
$band[4]->SetOrder(DEPTH_FRONT);
$band[5] = new PlotBand(HORIZONTAL, BAND_SOLID, 20, "max", "lightgreen");
$band[6] = new PlotBand(HORIZONTAL, BAND_3DPLANE, -10, 0, "blue");
$band[6]->SetDensity(70);
$graph->Add($band);
$graph->AddLine(new PlotLine(HORIZONTAL, 0, "black", 2));
//$graph->title->Set("Test of bar gradient fill");
$graph->xaxis->title->Set("X-title");
$graph->yaxis->title->Set("Y-title");
$graph->yaxis->title->SetFont(FF_ARIAL, FS_BOLD, 11);
$graph->xaxis->title->SetFont(FF_ARIAL, FS_BOLD, 11);
$graph->Stroke();
?>
示例3: liner3Show
public static function liner3Show($data_x, $data_y, $x_title, $y_title, $graph_title)
{
// echo var_dump($data_x);
// echo var_dump($data_y);
$graph = new Graph(LENHSIZE, HEISIZE);
//創建畫布
$graph->img->SetMargin(LEFT, 80, UP, DOWN);
//設置統計圖所在畫布的位置,左邊距50、右邊距40、上邊距30、下邊距40,單位為像素
// $graph->yscale->ticks->Set($max_y/2,1);
$graph->img->SetAntiAliasing();
//設置折線的平滑狀態
$graph->SetScale("textlin", 210, 230);
//設置刻度樣式
$graph->SetShadow();
//創建畫布陰影
$graph->xgrid->Show();
$line = new PlotLine(HORIZONTAL, 220, "red", 2);
//設置紅色警戒線
$line->SetLegend("警戒線");
$graph->legend->setFont(FF_SIMSUN, FS_BOLD, GRAGHSIZE - 5);
$graph->AddLine($line, false);
$graph->title->Set($graph_title);
//設置標題
$graph->title->SetFont(FF_SIMSUN, FS_BOLD, GRAGHSIZE);
//設置標題字體
$graph->SetMarginColor("lightblue");
//設置畫布的背景顏色為淡藍色
$graph->yaxis->title->SetFont(FF_SIMSUN, FS_BOLD);
//設置Y軸標題的字體
$graph->xaxis->SetPos("min");
// $graph->yaxis->HideZeroLabel();
// $graph->ygrid->SetFill(true,'#EFEFEF@0.5','#BBCCFF@0.5');
// $a=array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"); //X軸
$graph->xaxis->SetTickLabels($data_x);
//設置X軸
$graph->xaxis->SetFont(FF_SIMSUN);
//設置X坐標軸的字體
// $graph->yscale->SetGrace(20);
$p1 = new LinePlot($data_y);
//創建折線圖對象
$p1->mark->SetType(MARK_FILLEDCIRCLE);
//設置數據坐標點為圓形標記
$p1->mark->SetFillColor("black");
//設置填充的顏色
$p1->mark->SetWidth(3);
//設置圓形標記的直徑為3像素
$p1->SetColor("blue");
// $p1->SetYMin(0);
$graph->Add($p1);
$graph->InitializeFrameAndMargin();
$num = rand(0, RAND);
// echo var_dump($num);
$name = "Histogrm" . $num . ".png";
session_start();
$_SESSION["name"] = $name;
// echo var_dump($name);
$graph->Stroke($name);
return $name;
}
示例4: PlotLine
// $i++;
// }
//
//
// echo '</pre>';
$lineplot->SetColor('blue');
$lineplot->SetFillColor("blue@0.8");
if ($starttime > strtotime('-13 months', $endtime)) {
$lineplot->SetStepStyle(true);
}
$orangeline = new PlotLine(HORIZONTAL, $aantalbedden * 0.8, 'orange', 1);
$redline = new PlotLine(HORIZONTAL, $aantalbedden * 0.9, 'red', 1);
$maxline = new PlotLine(HORIZONTAL, $aantalbedden, 'black', 1);
// Add the plot to the graph
$graph->Add($lineplot);
$graph->AddLine($orangeline);
$graph->AddLine($redline);
$graph->AddLine($maxline);
if ($starttime < strtotime('-6 months', $endtime)) {
// Trend
$prec = floor(count($ydata) / 10);
//echo $prec . '<br />';
$avg = array();
for ($i = 0; $i < count($ydata); $i++) {
$tmp = 0;
for ($j = 1; $j < $prec; $j++) {
$tmp += $ydata[$i - $j];
$tmp += $ydata[$i + $j];
}
$tmp += $ydata[$i];
//echo $tmp . '<br />';
示例5: PlotLine
$graph->SetMarginColor("khaki");
// Set legend box specification
$graph->legend->SetFillColor("white");
$graph->legend->SetLineWeight(2);
// Set X-axis at the minimum value of Y-axis (default will be at 0)
$graph->xaxis->SetPos("min");
// "min" will position the x-axis at the minimum value of the Y-axis
// Extend the margin for the labels on the Y-axis and reverse the direction
// of the ticks on the Y-axis
$graph->yaxis->SetLabelMargin(12);
$graph->xaxis->SetLabelMargin(6);
$graph->yaxis->SetTickSide(SIDE_LEFT);
$graph->xaxis->SetTickSide(SIDE_DOWN);
// Add mark graph with static lines
$line = new PlotLine(HORIZONTAL, 0, "black", 2);
$graph->AddLine($line);
// Create a new impuls type scatter plot
$sp1 = new ScatterPlot($datay, $datax);
$sp1->mark->SetType(MARK_SQUARE);
$sp1->mark->SetFillColor("red");
$sp1->mark->SetWidth(3);
$sp1->SetImpuls();
$sp1->SetColor("blue");
$sp1->SetWeight(1);
$sp1->SetLegend("Non-causal signal");
$graph->Add($sp1);
// Create the envelope plot
$ep1 = new LinePlot($datayenv, $datax);
$ep1->SetStyle("dotted");
$ep1->SetLegend("Positive envelope");
$graph->Add($ep1);
示例6: each
$graph->xaxis->SetFont(FF_FONT1, FS_BOLD);
$graph->yaxis->SetTitleMargin(30);
$graph->xaxis->SetPos("min");
//$graph->xaxis->SetTitle("Day of Month");
//$graph->xaxis->SetTickLabels($xlabels);
$graph->xaxis->SetLabelFormatString("M d", true);
$graph->xaxis->SetLabelAngle(90);
$graph->yaxis->SetTitle("Precipitation (in)");
$graph->title->Set($cities[$station]["name"] . " [{$station}] Precipitation for " . $year);
$graph->subtitle->Set("Climate Site: " . $cities[$climate_site]["name"] . "[" . $climate_site . "]");
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->Pos(0.05, 0.1, "right", "top");
reset($times);
while (list($k, $v) = each($times)) {
if (date("d", $v) == 1) {
$graph->AddLine(new PlotLine(VERTICAL, $v, "tan", 1));
}
}
// Create the linear plot
$lp0 = new LinePlot($cdiff, $times);
$lp0->SetColor("green");
$lp0->SetLegend("Accum Difference");
$b2plot = new BarPlot($obs, $atimes);
$b2plot->SetFillColor("blue");
$b2plot->SetLegend("Obs Rain");
// Create the linear plot
$lp1 = new LinePlot($aobs, $atimes);
$lp1->SetLegend("Actual Accum");
$lp1->SetColor("blue");
$lp1->SetWeight(3);
$lp2 = new LinePlot($aclimate, $times);
示例7: LinePlot
// Create the linear plot
$lineplot3 = new LinePlot($s2_hi);
$lineplot3->SetLegend($cities[$station2]["name"] . " Avg High");
$lineplot3->SetColor("blue");
// Create the linear plot
$lineplot4 = new LinePlot($s2_lo);
$lineplot4->SetLegend("Low");
$lineplot4->SetColor("blue");
// Create the linear plot
$lineplot5 = new LinePlot($s2_av);
$lineplot5->SetLegend("Avg");
$lineplot5->SetColor("blue");
// Create the linear plot
$lineplot6 = new LinePlot($s1_av);
$lineplot6->SetLegend("Avg");
$lineplot6->SetColor("red");
// Add the plot to the graph
$graph->Add($lineplot);
$graph->Add($lineplot6);
$graph->Add($lineplot2);
$graph->Add($lineplot3);
$graph->Add($lineplot5);
$graph->Add($lineplot4);
for ($i = 0; $i < 11; $i++) {
$graph->AddLine(new PlotLine(VERTICAL, 7 + $i * 10, "tan", 1));
}
// Display the graph
$graph->Stroke();
?>
示例8: LinePlot
// Create the linear plot
$lineplot = new LinePlot($ydata);
$graph->Add($lineplot);
$lineplot->SetLegend("Max " . $var . " (F)");
$lineplot->SetColor("red");
// Create the linear plot
$lineplot2 = new LinePlot($ydata2);
$graph->Add($lineplot2);
$lineplot2->SetLegend("Min " . $var . " (F)");
$lineplot2->SetColor("blue");
// Create the linear plot
$lineplot3 = new LinePlot($ydata3);
$graph->Add($lineplot3);
$lineplot3->SetLegend("Average (F)");
$lineplot3->SetColor("brown");
$graph->AddLine(new PlotLine(VERTICAL, 31, "tan", 1));
$graph->AddLine(new PlotLine(VERTICAL, 60, "tan", 1));
$graph->AddLine(new PlotLine(VERTICAL, 91, "black", 1));
$graph->AddLine(new PlotLine(VERTICAL, 121, "tan", 1));
$graph->AddLine(new PlotLine(VERTICAL, 152, "tan", 1));
$graph->AddLine(new PlotLine(VERTICAL, 182, "black", 1));
$graph->AddLine(new PlotLine(VERTICAL, 213, "tan", 1));
$graph->AddLine(new PlotLine(VERTICAL, 244, "tan", 1));
$graph->AddLine(new PlotLine(VERTICAL, 274, "black", 1));
$graph->AddLine(new PlotLine(VERTICAL, 305, "tan", 1));
$graph->AddLine(new PlotLine(VERTICAL, 335, "tan", 1));
$graph->AddLine(new PlotLine(HORIZONTAL, 32, "blue", 2));
// Add the plot to the graph
// Display the graph
$graph->Stroke();
?>
示例9: LinePlot
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD, 12);
$graph->xaxis->SetTitle("Year");
$graph->xaxis->SetTitleMargin(35);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD, 12);
$graph->xaxis->SetPos("min");
$graph->legend->Pos(0.01, 0.07000000000000001);
$graph->legend->SetLayout(LEGEND_HOR);
// Create the linear plot
$lineplot = new LinePlot($ydata);
$lineplot->SetLegend("Avg High (F)");
$lineplot->SetColor("red");
// Create the linear plot
$lineplot2 = new LinePlot($ydata2);
$lineplot2->SetLegend("Avg Temp (F)");
$lineplot2->SetColor("green");
// Create the linear plot
$lineplot3 = new LinePlot($ydata3);
$lineplot3->SetLegend("Avg Low (F)");
$lineplot3->SetColor("blue");
// Add the plot to the graph
$graph->Add($lineplot);
$graph->Add($lineplot2);
$graph->Add($lineplot3);
for ($i = 0; $i < $decades; $i++) {
$graph->AddLine(new PlotLine(VERTICAL, $offset + $i * 10, "tan", 1));
}
// Display the graph
$graph->Stroke();
?>