$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(); ?>
$odo[$i] = new Odometer(); $odo[$i]->SetColor('lightgray:1.9'); $odo[$i]->needle->Set(10 + $i * 17); $odo[$i]->needle->SetShadow(); if ($i < 2) { $fsize = 10; } else { $fsize = 8; } $odo[$i]->scale->label->SetFont(FF_ARIAL, FS_NORMAL, $fsize); $odo[$i]->AddIndication(92, 100, 'red'); $odo[$i]->AddIndication(80, 92, 'orange'); $odo[$i]->AddIndication(60, 80, 'yellow'); } // Create the layout $row1 = new LayoutHor(array($odo[0], $odo[1])); $row2 = new LayoutHor(array($odo[2], $odo[3], $odo[4])); $col1 = new LayoutVert(array($row1, $row2)); // Add the odometer to the graph $graph->Add($col1); // Add an icon and text $icon = new IconPlot('jpglogo.jpg', 250, 10, 0.85, 30); $icon->SetAnchor('center', 'top'); $graph->Add($icon); $t = new Text('JpGraph', 250, 70); $t->SetAlign('center', 'top'); #$t->SetFont(FF_VERA,FS_BOLD,11); $t->SetColor('darkgray'); $graph->Add($t); // ... and finally stroke and stream the image back to the browser $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();