| 1 |
lars |
1 |
<style type="text/css">
|
|
|
2 |
<!--
|
|
|
3 |
A:link {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: none; color: #0000ff}
|
|
|
4 |
A:visited {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: none; color: #0000ff}
|
|
|
5 |
A:hover {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: underline; color: #FF0000}
|
|
|
6 |
th {font-family: helvetica, arial; color : blue; font-size:85%; background : lightgrey; border-right:black solid 1pt; border-bottom:black solid 1pt;}
|
|
|
7 |
//-->
|
|
|
8 |
</style><hr><a name="_C_FIELDPLOT"><div style="background-color:yellow;font-family:courier new;"></a>CLASS <b>FieldPlot</b> EXTENDS <a href="Plot .html#_C_PLOT " style="font-face:arial;font-weight:bold;">Plot </a></div>
|
|
|
9 |
<i>(Defined in: jpgraph_scatter.php : 63)</i><table border=1><tr><td> <a href="FieldPlot.html" style="font-family:arial;font-weight:bold;color:darkblue;">FieldPlot</a> </td><td> <a href="Plot .html" style="font-family:arial;font-weight:bold;color:darkblue;">Plot </a> </td></tr><tr><td valign=top> <a href="FieldPlot.html#_FIELDPLOT_FIELDPLOT">FieldPlot()</a> <br>
|
|
|
10 |
<a href="FieldPlot.html#_FIELDPLOT_SETCALLBACK">SetCallback()</a> <br>
|
|
|
11 |
</td><td valign=top> </td></tr></table> <p><div style="font-weight:bold;font-family:arial;font-size:100%;">Class usage and Overview</div>A variant of scatter plot is the so called <i>Field Plots</i> this is
|
|
|
12 |
basically a scatter plot where each scatter point is an arrow with a
|
|
|
13 |
direction between 0 to 359 degrees. This effectively allows the
|
|
|
14 |
visualization of 3 parameters at each point (x,y,angle). As an
|
|
|
15 |
additional bonus there is also possible to define a callback for each
|
|
|
16 |
scatter plot to also define the color for each point. <p>
|
|
|
17 |
<div style="font-weight:bold;font-family:arial;font-size:85%;">See also related classes:</div><a href="FieldArrow.html">FieldArrow</a> <p> <hr><span style="font-family:arial;font-size:120%;font-weight:bold;">Class Methods</span><hr><p>
|
|
|
18 |
<p> <p> <span style='font-size:110%;'><a name="_FIELDPLOT_FIELDPLOT"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
|
|
|
19 |
function FieldPlot($datay,$datax,$angles)</font>
|
|
|
20 |
</b></div></a></span>
|
|
|
21 |
|
|
|
22 |
<span style='font-family:arial;font-size:90%;'><i>Create an instance of FieldPlot</i></span><p>
|
|
|
23 |
|
|
|
24 |
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
|
|
|
25 |
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
|
|
26 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
27 |
$datay</font>
|
|
|
28 |
|
|
|
29 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Y-coordinate</td></tr>
|
|
|
30 |
|
|
|
31 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
32 |
$datax</font>
|
|
|
33 |
|
|
|
34 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>X-coordinate</td></tr>
|
|
|
35 |
|
|
|
36 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
37 |
$angles</font>
|
|
|
38 |
|
|
|
39 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Angle</td></tr>
|
|
|
40 |
</table>
|
|
|
41 |
|
|
|
42 |
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Create a new instance of a field plot <br>
|
|
|
43 |
|
|
|
44 |
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
|
|
|
45 |
$fp = new FieldPlot($datay,$datax,$angle);</font>
|
|
|
46 |
</span><br>
|
|
|
47 |
<p>
|
|
|
48 |
<p> <p> <span style='font-size:110%;'><a name="_FIELDPLOT_SETCALLBACK"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
|
|
|
49 |
function SetCallback($aFunc)</font>
|
|
|
50 |
</b></div></a></span>
|
|
|
51 |
|
|
|
52 |
<span style='font-family:arial;font-size:90%;'><i>Specify callback for each arrow in the field plot</i></span><p>
|
|
|
53 |
|
|
|
54 |
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
|
|
|
55 |
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
|
|
56 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
57 |
$aFunc</font>
|
|
|
58 |
|
|
|
59 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Function name</td></tr>
|
|
|
60 |
</table>
|
|
|
61 |
|
|
|
62 |
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Specify a callback that gets clled for each arrow in the field plot
|
|
|
63 |
The callback should return an array with the elements
|
|
|
64 |
<ol>
|
|
|
65 |
<li> Color
|
|
|
66 |
<li> Size of arrow (in pixels)
|
|
|
67 |
<li> Arrow head size (as integer between0 and 9)
|
|
|
68 |
</ol>
|
|
|
69 |
<br>
|
|
|
70 |
|
|
|
71 |
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
|
|
|
72 |
// Gradient. Make the arrows red at the pole and colder (blue)
<br />// teh further we get from the pole
<br />function FldCallback($x,$y,$a) {
<br /> $polex=4;
<br /> $poley=40;
<br /> $maxr = 3000;
<br />
<br /> // Size and arrow size is constant
<br /> $size="";
<br /> $arrowsize="";
<br />
<br /> // Since we have different scales we need the data points
<br /> // to be of the same magnitude to give it a distance
<br /> // interpretation.
<br /> $x *= 10;
<br />
<br /> // Colors gets colder the further out we go from the center
<br /> $r = ($x-$polex*10)*($x-$polex*10)+($y-$poley)*($y-$poley);
<br /> $f = $r/$maxr;
<br /> if( $f > 1 ) $f=1;
<br /> $red = floor((1-$f)*255);
<br /> $blue = floor($f*255);
<br /> $color = array($red,0,$blue);
<br /> return array($color,$size,$arrowsize);
<br />}
<br />
<br />// Setup the field plot
<br />$fp = new FieldPlot($datay,$datax,$angle);
<br />
<br />// Setup formatting callback
<br />$fp->SetCallback('FldCallback');</font>
|
|
|
73 |
</span><br>
|
|
|
74 |
<p> <hr> <p>
|