mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-01 00:24:21 +02:00
add jpgraph (Q LICENSE)
git-svn-id: http://www.observium.org/svn/observer/trunk@358 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
<style type="text/css">
|
||||
<!--
|
||||
A:link {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: none; color: #0000ff}
|
||||
A:visited {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: none; color: #0000ff}
|
||||
A:hover {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: underline; color: #FF0000}
|
||||
th {font-family: helvetica, arial; color : blue; font-size:85%; background : lightgrey; border-right:black solid 1pt; border-bottom:black solid 1pt;}
|
||||
//-->
|
||||
</style><hr><a name="_C_FUNCGENERATOR"><div style="background-color:yellow;font-family:courier new;"></a>CLASS <b>FuncGenerator</b></div>
|
||||
<i>(Defined in: jpgraph.php : 676)</i><table border=1><tr><td> <a href="FuncGenerator.html" style="font-family:arial;font-weight:bold;color:darkblue;">FuncGenerator</a> </td></tr><tr><td valign=top> <a href="FuncGenerator.html#_FUNCGENERATOR_E">E()</a> <br>
|
||||
<a href="FuncGenerator.html#_FUNCGENERATOR_FUNCGENERATOR">FuncGenerator()</a> <br>
|
||||
</td></tr></table> <p><div style="font-weight:bold;font-family:arial;font-size:100%;">Class usage and Overview</div>A utility class to help with function plots. This class supprots both ordinary one-variable plots with one dependent variable as well as polar plots.
|
||||
|
||||
Basically you create an instance of this class with the function you want to plot as a string argument. The function should be created using 'x' as the independent variable. You then invoke its evaluation method 'E()' with the range for the independent variable and possibly a step size. The method then returns an array of X, and Y values that represents the plot.
|
||||
|
||||
Please remember that the string should be specified with single quotes since otherwise PHP will try to interpret the variable in the string.
|
||||
|
||||
For example, to specify a simple cos() plot you specify:
|
||||
|
||||
$f = new FuncGenerator('cos($x)';
|
||||
<p>
|
||||
<hr><span style="font-family:arial;font-size:120%;font-weight:bold;">Class Methods</span><hr><p>
|
||||
<p> <p> <span style='font-size:110%;'><a name="_FUNCGENERATOR_E"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
|
||||
function E($aXMin,$aXMax,$aSteps)</font>
|
||||
</b></div></a></span>
|
||||
|
||||
<span style='font-family:arial;font-size:90%;'><i>Evaluate a X-Y function</i></span><p>
|
||||
|
||||
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
|
||||
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
||||
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
||||
$aXMin</font>
|
||||
|
||||
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Min x-value</td></tr>
|
||||
|
||||
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
||||
$aXMax</font>
|
||||
|
||||
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Max x-value</td></tr>
|
||||
|
||||
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
||||
$aSteps</font>
|
||||
|
||||
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
||||
50</font>
|
||||
</td><td>Number of steps</td></tr>
|
||||
</table>
|
||||
|
||||
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Evaluate the previous specified function between the specified values. The return two arrays representing the X and Y coordinates for the function. <br>
|
||||
|
||||
<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">
|
||||
// Create a simple linear plot␍<br />$f = new FuncGenerator('cos($x) * sin($x)');␍<br />list($xdata,$ydata) = $f->E(-2*M_PI, 2*M_PI);␍<br />␍<br />$lp1 = new LinePlot($ydata,$xdata);␍<br />␍<br />// Create a simple polar plot (a circle)␍<br />$p = new FuncGenerator('cos($i)', 'sin($i)');␍<br />list($x2data,$y2data) = $f->E(-2*M_PI, 2*M_PI);␍<br />␍<br />$lp2 = new LinePlot($y2data,$x2data);␍<br />␍<br />//...</font>
|
||||
</span><br>
|
||||
<p>
|
||||
<p> <p> <span style='font-size:110%;'><a name="_FUNCGENERATOR_FUNCGENERATOR"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
|
||||
function FuncGenerator($aFunc,$aXFunc)</font>
|
||||
</b></div></a></span>
|
||||
|
||||
<span style='font-family:arial;font-size:90%;'><i>Create a new function generator.</i></span><p>
|
||||
|
||||
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
|
||||
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
||||
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
||||
$aFunc</font>
|
||||
|
||||
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Function</td></tr>
|
||||
|
||||
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
||||
$aXFunc</font>
|
||||
|
||||
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
||||
''</font>
|
||||
</td><td>X-Function</td></tr>
|
||||
</table>
|
||||
|
||||
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Creates a new funciton generator. You can create both a linear plot as well as polar plot.
|
||||
|
||||
For linear, one-variable plots, you must use '$x' as the independent variable.
|
||||
|
||||
For polar plots you should use the index '$i' for the generating functions.
|
||||
<br>
|
||||
|
||||
<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">
|
||||
// Create a simple linear plot␍<br />$f = new FuncGenerator('cos($x) * sin($x)');␍<br />list($xdata,$ydata) = $f->E(-2*M_PI, 2*M_PI);␍<br />␍<br />$lp1 = new LinePlot($ydata,$xdata);␍<br />␍<br />// Create a simple polar plot (a circle)␍<br />$p = new FuncGenerator('cos($i)', 'sin($i)');␍<br />list($x2data,$y2data) = $f->E(-2*M_PI, 2*M_PI);␍<br />␍<br />$lp2 = new LinePlot($y2data,$x2data);␍<br />␍<br />//...␍<br /></font>
|
||||
</span><br>
|
||||
<p> <hr> <p>
|
||||
Reference in New Issue
Block a user