$graph->hgrid->Show(); $graph->hgrid->SetRowFillColor('darkblue@0.9'); for ($i = 0; $i < count($data); ++$i) { $bar = new GanttBar($data[$i][0], $data[$i][1], $data[$i][2], $data[$i][3], "[5%]", 10); if (count($data[$i]) > 4) { $bar->title->SetFont($data[$i][4], $data[$i][5], $data[$i][6]); } $bar->SetPattern(BAND_RDIAG, "yellow"); $bar->SetFillColor("red"); $graph->Add($bar); } // Setup a vertical marker line $vline = new GanttVLine("2001-11-01"); $vline->SetDayOffset(0.5); $vline->title->Set("2001-11-01"); $vline->title->SetFont(FF_FONT1, FS_BOLD, 10); $graph->Add($vline); // Setup a milestone $ms = new MileStone(6, "M5", "2001-11-28", "28/12"); $ms->title->SetFont(FF_FONT1, FS_BOLD); $graph->Add($ms); // And to show that you can also add an icon we add "Tux" $icon = new IconPlot('penguin.png', 0.05, 0.95, 1, 15); $icon->SetAnchor('left', 'bottom'); $graph->Add($icon); // .. and finally send it back to the browser $graph->Stroke(); ?>
$datay2 = array(3, 25, 10, 15, 50, 5, 18); $datay3 = array(10, 5, 10, 15, 5, 2, 1); // Setup the graph $graph = new Graph(400, 250); $graph->SetMargin(40, 40, 20, 30); $graph->SetScale("textlin"); $graph->title->Set('Adding an icon ("tux") in the background'); $graph->title->SetFont(FF_ARIAL, FS_NORMAL, 12); //$graph->SetBackgroundGradient('red','blue'); $graph->xaxis->SetPos('min'); $p1 = new LinePlot($datay); $p1->SetColor("blue"); $p1->SetFillGradient('yellow@0.4', 'red@0.4'); $p2 = new LinePlot($datay2); $p2->SetColor("black"); $p2->SetFillGradient('green@0.4', 'white'); $p3 = new LinePlot($datay3); $p3->SetColor("blue"); $p3->SetFillGradient('navy@0.4', 'white@0.4'); $graph->Add($p1); $graph->Add($p2); $graph->Add($p3); $icon = new IconPlot('penguin.png', 0.2, 0.3, 1, 30); $icon->SetAnchor('center', 'center'); $graph->Add($icon); // Output line $graph->Stroke(); ?>
<?php // content="text/plain; charset=utf-8" require_once 'jpgraph/jpgraph.php'; require_once 'jpgraph/jpgraph_line.php'; require_once 'jpgraph/jpgraph_flags.php'; require_once 'jpgraph/jpgraph_iconplot.php'; $datay = array(30, 25, 33, 25, 27, 45, 32); // Setup the graph $graph = new Graph(400, 250); $graph->SetMargin(40, 40, 20, 30); $graph->SetScale("textlin"); $graph->title->Set('Adding a country flag as a an icon'); $p1 = new LinePlot($datay); $p1->SetColor("blue"); $p1->SetFillGradient('yellow@0.4', 'red@0.4'); $graph->Add($p1); $icon = new IconPlot(); $icon->SetCountryFlag('iceland', 50, 30, 1.5, 40, 3); $icon->SetAnchor('left', 'top'); $graph->Add($icon); // Output line $graph->Stroke(); ?>
$activity->SetHeight(10); // Specify progress to 60% $activity->progress->Set(0.6); $activity->progress->SetPattern(BAND_HVCROSS, "blue"); // Format the bar for the second activity // ($row,$title,$startdate,$enddate) $activity2 = new GanttBar(1, "Project", "2001-12-21", "2002-01-02", "[30%]"); // Yellow diagonal line pattern on a red background $activity2->SetPattern(BAND_RDIAG, "yellow"); $activity2->SetFillColor("red"); // Set absolute height $activity2->SetHeight(10); // Specify progress to 30% $activity2->progress->Set(0.3); $activity2->progress->SetPattern(BAND_HVCROSS, "blue"); // Finally add the bar to the graph $graph->Add($activity); $graph->Add($activity2); // Add a coutnry flag $icon = new IconPlot(); $icon->SetAnchor('left', 'top'); $icon->SetCountryFlag('norway'); $icon->SetMix(50); $icon->SetPos(5, 5); $graph->Add($icon); // Add a vertical line $vline = new GanttVLine("2001-12-24", "Phase 1"); $vline->SetDayOffset(0.5); //$graph->Add($vline); // ... and display it $graph->Stroke();
<?php require_once 'jpgraph/jpgraph.php'; require_once 'jpgraph/jpgraph_windrose.php'; require_once 'jpgraph/jpgraph_iconplot.php'; $data = array(0 => array(1, 1, 2.5, 4), 1 => array(3, 4, 1, 4), 'wsw' => array(1, 5, 5, 3), 'N' => array(2, 7, 5, 4, 2), 15 => array(2, 7, 12)); // First create a new windrose graph with a title $graph = new WindroseGraph(400, 400); // Creta an icon to be added to the graph $icon = new IconPlot('tornado.jpg', 10, 10, 1.3, 50); $icon->SetAnchor('left', 'top'); $graph->Add($icon); // Setup title $graph->title->Set('Windrose icon example'); $graph->title->SetFont(FF_VERDANA, FS_BOLD, 12); $graph->title->SetColor('navy'); // Create the windrose plot. $wp = new WindrosePlot($data); // Add to graph and send back to client $graph->Add($wp); $graph->Stroke(); ?>
<?php require_once 'jpgraph/jpgraph.php'; require_once 'jpgraph/jpgraph_matrix.php'; require_once 'jpgraph/jpgraph_iconplot.php'; $data = array(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10), array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0), array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10), array(10, 9, 8, 17, 6, 5, 4, 3, 2, 1, 0), array(0, 1, 2, 3, 4, 4, 9, 7, 8, 9, 10), array(8, 1, 2, 3, 4, 8, 3, 7, 8, 9, 10), array(10, 3, 5, 7, 6, 5, 4, 3, 12, 1, 0), array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)); // Do the meshinterpolation once for the data doMeshInterpolate($data, 3); $r = count($data); $c = count($data[0]); $width = 400; $height = 400; $graph = new MatrixGraph($width, $height); $graph->title->Set('Adding an icon to the background'); $graph->title->SetFont(FF_ARIAL, FS_BOLD, 14); $mp = new MatrixPlot($data, 1); $mp->SetSize(0.6); $icon = new IconPlot('icon.jpg', $width - 1, $height - 1, 0.8, 50); $icon->SetAnchor('right', 'bottom'); $graph->Add($icon); $graph->Add($mp); $graph->Stroke();