function plotRecessionCurve() { $xlabel = array(); $bankfull = array(); $flood = array(); $oldday = 0; for ($t = 0; $t < 240; $t = $t + 12) { $newday = strftime("%d", $this->basets + $t * 900); if ($t == 0 || intval($newday) != intval($oldday)) { $fmt = "%d %b %I %p"; } else { $fmt = "%I %p"; } $xlabel[$t] = strftime($fmt, $this->basets + $t * 900); $oldday = $newday; } for ($i = 0; $i < 240; $i++) { $bankfull[$i] = 2650; $flood[$i] = 3700; } global $rootpath; include_once "{$rootpath}/include/jpgraph/jpgraph.php"; include_once "{$rootpath}/include/jpgraph/jpgraph_line.php"; $graph = new Graph(640, 480, "example1"); $graph->SetScale("textlin"); $graph->setmargin(60, 20, 50, 80); $graph->tabtitle->Set("Hydrograph"); $graph->xaxis->SetTickLabels($xlabel); $graph->xaxis->SetTextTickInterval(12); $graph->xaxis->SetLabelAngle(90); $graph->yaxis->SetTitle("Flow @ Gauge (cfs)"); $graph->yaxis->SetTitleMargin(45); $graph->legend->Pos(0.01, 0.01); $graph->legend->SetLayout(LEGEND_HOR); $lineplot = new LinePlot($this->flow); $lineplot->SetColor("red"); $lineplot->SetLegend("Predicted Flow"); $lineplot2 = new LinePlot($this->baseflow); $lineplot2->SetColor("blue"); $lineplot2->SetLegend("Base Flow"); $lineplot3 = new LinePlot($bankfull); $lineplot3->SetColor("brown"); $lineplot3->SetLegend("BankFull (2650)"); $lineplot3->SetWeight(3); $lineplot4 = new LinePlot($flood); $lineplot4->SetColor("green"); $lineplot4->SetLegend("Flood (3700)"); $lineplot4->SetWeight(3); $lineplot5 = new LinePlot(array_slice($this->obflow, 0, 240)); $lineplot5->SetColor("black"); $lineplot5->SetLegend("Ob Flow"); $lineplot5->SetWeight(1); $graph->Add($lineplot5); $graph->Add($lineplot4); $graph->Add($lineplot3); $graph->Add($lineplot2); $graph->Add($lineplot); $fref = "/var/webtmp/10d_" . time() . ".png"; $graph->Stroke($fref); return "/tmp/10d_" . time() . ".png"; }