include "../jpgraph.php"; include "../jpgraph_line.php"; // Some data $ydata = array(5, 10, 15, 20, 15, 10, 8, 7, 4, 10, 5); // Create the graph $graph = new Graph(400, 300, "auto"); $graph->SetScale("textlin"); $graph->SetShadow(true); $graph->SetMarginColor("lightblue"); // Setup format for legend $graph->legend->SetFillColor("antiquewhite"); $graph->legend->SetShadow(true); // Setup title $graph->title->Set("Filled Area Example"); $graph->title->SetFont(FF_FONT2, FS_BOLD); // Setup semi-filled line plot $lineplot = new LinePlot($ydata); $lineplot->SetLegend("Semi-filled\nLineplot"); // Set line color $lineplot->SetColor("black"); // Setup the two areas to be filled $lineplot->AddArea(2, 5, LP_AREA_FILLED, "red"); $lineplot->AddArea(6, 8, LP_AREA_FILLED, "green"); // Display the marks on the lines $lineplot->mark->SetType(MARK_DIAMOND); $lineplot->mark->SetSize(8); $lineplot->mark->Show(); // add plot to the graph $graph->Add($lineplot); // display graph $graph->Stroke();
pg_close($coop); include "../../../include/jpgraph/jpgraph.php"; include "../../../include/jpgraph/jpgraph_bar.php"; include "../../../include/jpgraph/jpgraph_line.php"; include "../../../include/network.php"; $nt = new NetworkTable("IACLIMATE"); $cities = $nt->table; $graph = new Graph(600, 400, "example1"); $graph->SetScale("textlin", 0, 100); $graph->img->SetMargin(40, 5, 35, 60); $graph->xaxis->SetTickLabels($xdata); $graph->xaxis->SetTextTickInterval(100); $graph->xaxis->SetLabelAngle(90); $graph->xaxis->SetTitle("Precip [inches]"); $graph->xaxis->SetTitleMargin(30); $graph->yaxis->SetTitle("Cumulative Distribution (percent)"); $graph->title->Set($cities[$station]['name'] . " Precip Accumulation Probabilities"); $graph->subtitle->Set($subtitle); $l1 = new LinePlot($ydata); $l1->SetColor("blue"); $l1->SetWeight(2); $l1->AddArea($hm, $hm, LP_AREA_FILLED, "lightred"); $l1->AddArea($h95, $h95, LP_AREA_FILLED, "lightred"); $l1->AddArea($h5, $h5, LP_AREA_FILLED, "lightred"); $txt = new Text("Diagnostics\n Min: {$lowVal} ({$lowYear})\n 95%: " . ($lowVal + $h95 * 0.01) . "\n~Mean: " . ($lowVal + $hm * 0.01) . "\n SD: {$stddev}\n 5%: " . ($lowVal + $h5 * 0.01) . "\n Max: {$hiVal} ({$hiYear})\n"); $txt->SetPos(0.71, 0.128); $txt->SetFont(FF_FONT1, FS_NORMAL); $txt->SetColor("blue"); $graph->Add($l1); $graph->Add($txt); $graph->Stroke();
*/ $l1 = new LinePlot($y1); $l1->SetColor("red"); $l1->SetWeight(2); $l1->SetLegend("High Temp"); $l1->SetStyle('dashed'); $l2 = new LinePlot($y2); $l2->SetColor("blue"); $l2->SetWeight(2); $l2->SetLegend("Low Temp"); $l2->SetStyle('dashed'); $lp1 = new LinePlot($cy1); $lp1->SetColor("red"); $lp1->SetLegend("CDF (high temp)"); $lp1->AddArea($h5, $h95, LP_AREA_NOT_FILLED, "lightred"); $lp1->AddArea($hm, $hm, LP_AREA_FILLED, "lightred"); $lp1->SetWeight(2); $lp2 = new LinePlot($cy2); $lp2->SetColor("blue"); $lp2->SetLegend("CDF (low temp)"); $lp2->AddArea($l5, $l95, LP_AREA_NOT_FILLED, "lightblue"); $lp2->AddArea($lm, $lm, LP_AREA_FILLED, "lightblue"); $lp2->SetWeight(2); // Add the plot to the graph //$graph->Add($gbplot); $graph->AddY2($l1); $graph->AddY2($l2); $graph->Add($lp1); $graph->Add($lp2); // Display the graph $graph->Stroke();