Beispiel #1
0
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_windrose.php';
// Data can be specified using both ordinal index of the axis
// as well as the direction label
$data = array(0 => array(1, 1, 6, 4), 1 => array(3, 8, 1, 4), 2 => array(2, 7, 4, 4, 3), 3 => array(2, 7, 1, 2));
// First create a new windrose graph with a title
$graph = new WindroseGraph(400, 400);
// Setup title
$graph->title->Set('Windrose example 2');
$graph->title->SetFont(FF_VERDANA, FS_BOLD, 12);
$graph->title->SetColor('navy');
// Create the windrose plot.
$wp = new WindrosePlot($data);
// Make it have 8 compass direction
$wp->SetType(WINDROSE_TYPE4);
// Setup the weight of the laegs for the different ranges
$weights = array_fill(0, 8, 10);
$wp->SetRangeWeights($weights);
// Adjust the font and font color for scale labels
$wp->scale->SetFont(FF_TIMES, FS_NORMAL, 11);
$wp->scale->SetFontColor('navy');
// Set the diametr for the plot to 160 pixels
$wp->SetSize(160);
// Set the size of the innermost center circle to 30% of the plot size
$wp->SetZCircleSize(0.2);
// Adjust the font and font color for compass directions
$wp->SetFont(FF_ARIAL, FS_NORMAL, 12);
$wp->SetFontColor('darkgreen');
// Add and send back to browser
$graph->Add($wp);
Beispiel #2
0
// 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();
?>