$graph->title->SetFont(FF_VERDANA, FS_BOLD, 12); $graph->title->SetColor('navy'); $graph->subtitle->Set('(Multiple plots in the same graph)'); $graph->subtitle->SetFont(FF_VERDANA, FS_NORMAL, 9); $graph->subtitle->SetColor('navy'); // Create the two windrose plots. for ($i = 0; $i < count($data); ++$i) { $wp[$i] = new WindrosePlot($data[$i]); // Make it have 8 compass direction $wp[$i]->SetType($layout[$i][0]); // Adjust the font and font color for scale labels $wp[$i]->scale->SetFont(FF_TIMES, FS_NORMAL, 10); $wp[$i]->scale->SetFontColor('navy'); // Set the position of the plot $wp[$i]->SetPos($layout[$i][1], $layout[$i][2]); // Set the diameter for the plot to 30% of the width of the graph pixels $wp[$i]->SetSize($layout[$i][3]); // Set the size of the innermost center circle to 30% of the plot size $wp[$i]->SetZCircleSize($layout[$i][4]); // Adjust the font and font color for compass directions $wp[$i]->SetFont(FF_ARIAL, FS_NORMAL, 10); $wp[$i]->SetFontColor('darkgreen'); // Add legend text $wp[$i]->legend->SetText($legendtxt[$i]); $graph->Add($wp[$i]); } // Send the graph to the browser $graph->Stroke(); ?>
// as well as the direction label. $data = array('45.9' => array(3, 2, 1, 2, 2), 355 => array(1, 1, 1.5, 2), 180 => array(1, 1, 1.5, 2), 150 => array(1, 2, 1, 3), 'S' => array(2, 3, 5, 1)); // Add some labels for afew of the directions $labels = array(355 => "At\nHome base", 180 => "Probe\n123", 150 => "Power\nplant"); // Define the color,weight and style of some individual radial grid lines. $axiscolors = array(355 => "red"); $axisweights = array(355 => 8); $axisstyles = array(355 => 'solid', 150 => 'solid'); // First create a new windrose graph with a title $graph = new WindroseGraph(400, 460); $graph->title->Set('Adding label backgrounds'); $graph->title->SetFont(FF_VERDANA, FS_BOLD, 14); $graph->title->SetColor('navy'); // Create the free windrose plot. $wp = new WindrosePlot($data); $wp->SetType(WINDROSE_TYPEFREE); $wp->scale->SetLabelFillColor('lightblue', 'black'); // Specify colors weights and style for the radial gridlines $wp->SetRadialColors($axiscolors); $wp->SetRadialWeights($axisweights); $wp->SetRadialStyles($axisstyles); // Add a few labels $wp->SetLabels($labels); // Add some "arbitrary" text to the center $wp->scale->SetZeroLabel("SOx\n8%%"); // Finally add it to the graph and send back to client $graph->Add($wp); $graph->Stroke(); ?>
<?php require_once 'jpgraph/jpgraph.php'; require_once 'jpgraph/jpgraph_windrose.php'; // Data can be specified using both ordinal idex of axis as well // as the direction label $data = array(1 => array(10, 10, 13, 7), 2 => array(2, 8, 10), 4 => array(1, 12, 22)); $data2 = array(4 => array(12, 8, 2, 3), 2 => array(5, 4, 4, 5, 2)); // Create a new small windrose graph $graph = new WindroseGraph(660, 400); $graph->SetShadow(); $graph->title->Set('Two windrose plots in one graph'); $graph->title->SetFont(FF_ARIAL, FS_BOLD, 14); $graph->subtitle->Set('(Using Box() for each plot)'); $wp = new WindrosePlot($data); $wp->SetType(WINDROSE_TYPE8); $wp->SetSize(0.42); $wp->SetPos(0.25, 0.55); $wp->SetBox(); $wp2 = new WindrosePlot($data2); $wp2->SetType(WINDROSE_TYPE16); $wp2->SetSize(0.42); $wp2->SetPos(0.74, 0.55); $wp2->SetBox(); $wp2->SetRangeColors(array('green', 'yellow', 'red', 'brown')); $graph->Add($wp); $graph->Add($wp2); $graph->Stroke(); ?>
$wp1 = new WindrosePlot($data); $wp1->SetType(WINDROSE_TYPE16); // This is the default encoding $wp1->SetDataKeyEncoding(KEYENCODING_ANTICLOCKWISE); $wp1->legend->Hide(); $wp1->SetPos($xpos1, $ypos1); $wp1->SetSize(0.5); // Create the second plot $wp2 = new WindrosePlot($data); $wp2->SetType(WINDROSE_TYPE16); $wp2->SetDataKeyEncoding(KEYENCODING_CLOCKWISE); $wp2->legend->Hide(); $wp2->SetPos($xpos2, $ypos1); $wp2->SetSize(0.5); $txt1 = new Text('KEYENCODING_ANTICLOCKWISE'); $txt1->SetFont(FF_COURIER, FS_BOLD, 12); $txt1->SetPos($xpos1, $ypos2); $txt1->SetAlign('center', 'top'); $txt2 = new Text('KEYENCODING_CLOCKWISE'); $txt2->SetFont(FF_COURIER, FS_BOLD, 12); $txt2->SetPos($xpos2, $ypos2); $txt2->SetAlign('center', 'top'); // Finally add it to the graph and send back to the client $graph->Add($wp1); $graph->Add($txt1); $graph->Add($wp2); $graph->Add($txt2); $graph->Stroke(); ?>
require_once 'jpgraph/jpgraph.php'; require_once 'jpgraph/jpgraph_windrose.php'; // Some data for the five windrose plots $data = array(array(1 => array(10, 10, 13, 7), 2 => array(2, 8, 10), 4 => array(1, 12, 22)), array(4 => array(12, 8, 2, 3), 2 => array(5, 4, 4, 5, 2)), array(1 => array(12, 8, 2, 3), 3 => array(5, 4, 4, 5, 2)), array(2 => array(12, 8, 2, 3), 3 => array(5, 4, 4, 5, 2)), array(4 => array(12, 8, 2, 3), 6 => array(5, 4, 4, 5, 2))); // Legend range colors $rangecolors = array('green', 'yellow', 'red', 'brown'); // Create a windrose graph with titles $graph = new WindroseGraph(750, 700); $graph->title->Set('Multiple plots with automatic layout'); $graph->title->SetFont(FF_ARIAL, FS_BOLD, 14); // Setup the individual windrose plots $wp = array(); for ($i = 0; $i < 5; ++$i) { $wp[$i] = new WindrosePlot($data[$i]); $wp[$i]->SetType(WINDROSE_TYPE8); if ($i < 2) { $wp[$i]->SetSize(0.28); } else { $wp[$i]->legend->Hide(); $wp[$i]->SetSize(0.16); $wp[$i]->SetCenterSize(0.25); } $wp[$i]->SetRangeColors($rangecolors); } // Position with two rows. Two plots in top row and three plots in // bottom row. $hl1 = new LayoutHor(array($wp[0], $wp[1])); $hl2 = new LayoutHor(array($wp[2], $wp[3], $wp[4])); $vl = new LayoutVert(array($hl1, $hl2)); $graph->Add($vl); $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(); ?>
// Setup graph background color $graph->SetColor('darkgreen@0.7'); // Setup all the defined text boxes $n = count($txt); for ($i = 0; $i < $n; ++$i) { $txtbox[$i] = new Text($txt[$i]); $txtbox[$i]->SetPos($txtlayout[$i][0], $txtlayout[$i][1], 'right'); $txtbox[$i]->SetWordwrap($txtlayout[$i][2]); $txtbox[$i]->SetParagraphAlign($txtlayout[$i][3]); $txtbox[$i]->SetColor($txtlayout[$i][4]); $txtbox[$i]->SetBox($txtlayout[$i][5]); if (count($txtlayout[$i]) > 6) { $txtbox[$i]->SetFont($txtlayout[$i][6], $txtlayout[$i][7], $txtlayout[$i][8]); } } $graph->Add($txtbox); // Create the windrose plot. $wp = new WindrosePlot($data); // Set background color for plot area $wp->SetColor('lightyellow'); // Add a box around the plot $wp->SetBox(); // Setup the colors for the ranges $wp->SetRangeColors($rangeColors); // Adjust the font and font color for scale labels $wp->scale->SetFont(FF_ARIAL, FS_NORMAL, 9); $wp->scale->SetFontColor('navy'); // Set the diameter and position for plot $wp->SetSize(190); $wp->SetPos(0.35, 0.53); $wp->SetZCircleSize(0.2);