179 lines
16 KiB
HTML
179 lines
16 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><style type="text/css">
|
||
|
<!--
|
||
|
A:link {font-family: helvetica, arial, geneva, sans-serif; font-size: small; text-decoration: none; color: #000000}
|
||
|
A:visited {font-family: helvetica, arial, geneva, sans-serif; font-size: small; text-decoration: none; color: #000000}
|
||
|
A:hover {font-family: helvetica, arial, geneva, sans-serif; font-size: small; text-decoration: underline; color: #FF0000}
|
||
|
A.no:link {font-family:inherit; font-size: inhreit;text-decoration: none; color: #000000}
|
||
|
A.no:visited {font-family:inherit; font-size: inherit;text-decoration: none; color: #000000}
|
||
|
A.no:hover {font-family:inherit; font-size: inherit;text-decoration: none; color: #000000}
|
||
|
th {font-family: helvetica, arial; color : black; font-size:90%; background : #b7c8b7; border-right:black solid 1pt; border-bottom:black solid 1pt;}
|
||
|
td {font-family: helvetica, arial; color : black; font-size:90%; background : white; border-right:black solid 1pt; border-bottom:black solid 1pt;}
|
||
|
|
||
|
//-->
|
||
|
</style></HEAD><hr><div style="padding-left:4px;border-left:solid black 1px;border-top:solid black 1px;border-bottom:solid black 2px;border-right:solid black 2px;background-color:#deaa87;font-family:courier new;font-size:16pt;">Class <a class="no" name="_C_CANVASSCALE"><b>CanvasScale</b></a></div>
|
||
|
<i>(Defined in: jpgraph_canvtools.php : 24)</i><br> <br><table cellspaceing=0 cellpadding=4 style="border:solid #303030 1px;"><tr><td align="center" style="background:lightgray;" > <a href="CanvasScale.html" style="font-family:arial;font-weight:bold;color:darkblue;">CanvasScale</a> </td></tr><tr><td valign=top> <a href="CanvasScale.html#_CANVASSCALE_SET">Set()</a> <br>
|
||
|
<a href="CanvasScale.html#_CANVASSCALE_TRANSLATE">Translate()</a> <br>
|
||
|
<a href="CanvasScale.html#_CANVASSCALE_TRANSLATEX">TranslateX()</a> <br>
|
||
|
<a href="CanvasScale.html#_CANVASSCALE_TRANSLATEY">TranslateY()</a> <br>
|
||
|
<a href="CanvasScale.html#_CANVASSCALE___CONSTRUCT">__construct()</a> <br>
|
||
|
</td></tr></table> <p><div style="font-weight:bold;font-family:arial;font-size:100%;">Class usage and Overview</div>This class defines a scale which is meant to be used with canvas graphs to make it possibles to pecify a more convinient scale compared to absoilute pixels coordinates.
|
||
|
<br>
|
||
|
This will also let you scale the canvas without any coordinate changes. <p>
|
||
|
<hr><span style="font-family:arial;font-size:120%;font-weight:bold;">Class Methods</span><hr><p>
|
||
|
<p> <div style='font-family: helvetica, arial, geneva, sans-serif;margin-bottom:4px;border-left:solid black 1px;border-top:solid black 1px;border-bottom:solid black 2px;border-right:solid black 2px;font-size:120%;background:#dde9af;padding:4px;'><a class="no" name="_CANVASSCALE_SET"><span style="color:#555555;">CanvasScale ::</span><br><b>Set</b>($xmin, $xmax, $ymin, $ymax)</a></div>
|
||
|
|
||
|
<span style='font-family:arial;font-size:95%;'><i>Specify scale to use</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:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">$xmin</span>
|
||
|
</span>
|
||
|
|
||
|
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">0</span>
|
||
|
</span>
|
||
|
</td><td>Min X value</td></tr>
|
||
|
|
||
|
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">$xmax</span>
|
||
|
</span>
|
||
|
|
||
|
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">10</span>
|
||
|
</span>
|
||
|
</td><td>Max X-value</td></tr>
|
||
|
|
||
|
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">$ymin</span>
|
||
|
</span>
|
||
|
|
||
|
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">0</span>
|
||
|
</span>
|
||
|
</td><td>Min Y-value</td></tr>
|
||
|
|
||
|
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">$ymax</span>
|
||
|
</span>
|
||
|
|
||
|
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">10</span>
|
||
|
</span>
|
||
|
</td><td>Max Y-value</td></tr>
|
||
|
</table>
|
||
|
|
||
|
<div style="font-weight:bold;font-family:arial;font-size:90%;">Description:</div>SPecify min/max values for scale. <br>
|
||
|
|
||
|
<div style="font-weight:bold;font-family:arial;font-size:90%;"><p>Example:</div><div style="padding:5px;border:dashed gray 1px;background-color:#f3f3f3;font-family:courier new;font-size:90%;font-weight:bold;"><b><span style="color: #000000">
|
||
|
<span style="color: #0000BB"></span><span style="color: #FF8000">// Setup a basic canvas we can work
<br /></span><span style="color: #0000BB">$g </span><span style="color: #007700">= new </span><span style="color: #0000BB">CanvasGraph</span><span style="color: #007700">(</span><span style="color: #0000BB">400</span><span style="color: #007700">,</span><span style="color: #0000BB">200</span><span style="color: #007700">,</span><span style="color: #DD0000">'auto'</span><span style="color: #007700">);
<br /></span><span style="color: #0000BB">$g</span><span style="color: #007700">-></span><span style="color: #0000BB">SetMargin</span><span style="color: #007700">(</span><span style="color: #0000BB">5</span><span style="color: #007700">,</span><span style="color: #0000BB">11</span><span style="color: #007700">,</span><span style="color: #0000BB">6</span><span style="color: #007700">,</span><span style="color: #0000BB">11</span><span style="color: #007700">);
<br /></span><span style="color: #0000BB">$g</span><span style="color: #007700">-></span><span style="color: #0000BB">SetShadow</span><span style="color: #007700">();
<br /></span><span style="color: #0000BB">$g</span><span style="color: #007700">-></span><span style="color: #0000BB">SetMarginColor</span><span style="color: #007700">(</span><span style="color: #DD0000">"teal"</span><span style="color: #007700">);
<br />
<br /></span><span style="color: #FF8000">// We need to stroke the plotarea and margin before we add the
<br />// text since we otherwise would overwrite the text.
<br /></span><span style="color: #0000BB">$g</span><span style="color: #007700">-></span><span style="color: #0000BB">InitFrame</span><span style="color: #007700">();
<br />
<br /></span><span style="color: #FF8000">// Create a new scale
<br /></span><span style="color: #0000BB">$scale </span><span style="color: #007700">= new </span><span style="color: #0000BB">CanvasScale</span><span style="color: #007700">(</span><span style="color: #0000BB">$g</span><span style="color: #007700">);
<br /></span><span style="color: #0000BB">$scale</span><span style="color: #007700">-></span><span style="color: #0000BB">Set</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">$xmax</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">$ymax</span><span style="color: #007700">);
<br /></span><span style="color: #0000BB"></span>
|
||
|
</span>
|
||
|
</b></div><br>
|
||
|
<p>
|
||
|
<p> <div style='font-family: helvetica, arial, geneva, sans-serif;margin-bottom:4px;border-left:solid black 1px;border-top:solid black 1px;border-bottom:solid black 2px;border-right:solid black 2px;font-size:120%;background:#dde9af;padding:4px;'><a class="no" name="_CANVASSCALE_TRANSLATE"><span style="color:#555555;">CanvasScale ::</span><br><b>Translate</b>($x, $y)</a></div>
|
||
|
|
||
|
<span style='font-family:arial;font-size:95%;'><i>Translate a point to absolute screen coordinates</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:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">$x</span>
|
||
|
</span>
|
||
|
|
||
|
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'> </td><td>X-value</td></tr>
|
||
|
|
||
|
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">$y</span>
|
||
|
</span>
|
||
|
|
||
|
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'> </td><td>Y-value</td></tr>
|
||
|
</table>
|
||
|
|
||
|
<div style="font-weight:bold;font-family:arial;font-size:90%;">Description:</div>Translate a point to absolute screen coordinates <br>
|
||
|
<div style="font-weight:bold;font-family:arial;font-size:90%;">See also:</div><ul><li><a href="CanvasScale.html#_CANVASSCALE_TRANSLATEX">CanvasScale::TranslateX()</a><li><a href="CanvasScale.html#_CANVASSCALE_TRANSLATEY">CanvasScale::TranslateY()</a></ul>
|
||
|
<div style="font-weight:bold;font-family:arial;font-size:90%;"><p>Example:</div><div style="padding:5px;border:dashed gray 1px;background-color:#f3f3f3;font-family:courier new;font-size:90%;font-weight:bold;"><b><span style="color: #000000">
|
||
|
<span style="color: #0000BB"></span><span style="color: #007700">list(</span><span style="color: #0000BB">$xt</span><span style="color: #007700">,</span><span style="color: #0000BB">$yt</span><span style="color: #007700">) = </span><span style="color: #0000BB">$scale</span><span style="color: #007700">-></span><span style="color: #0000BB">Translate</span><span style="color: #007700">(</span><span style="color: #0000BB">$x</span><span style="color: #007700">,</span><span style="color: #0000BB">$y</span><span style="color: #007700">);
<br /></span><span style="color: #0000BB">$graph</span><span style="color: #007700">-></span><span style="color: #0000BB">img</span><span style="color: #007700">-></span><span style="color: #0000BB">Point</span><span style="color: #007700">(</span><span style="color: #0000BB">$xt</span><span style="color: #007700">,</span><span style="color: #0000BB">$yt</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
|
||
|
</span>
|
||
|
</b></div><br>
|
||
|
<p>
|
||
|
<p> <div style='font-family: helvetica, arial, geneva, sans-serif;margin-bottom:4px;border-left:solid black 1px;border-top:solid black 1px;border-bottom:solid black 2px;border-right:solid black 2px;font-size:120%;background:#dde9af;padding:4px;'><a class="no" name="_CANVASSCALE_TRANSLATEX"><span style="color:#555555;">CanvasScale ::</span><br><b>TranslateX</b>($x)</a></div>
|
||
|
|
||
|
<span style='font-family:arial;font-size:95%;'><i>Translate X-coordinate</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:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">$x</span>
|
||
|
</span>
|
||
|
|
||
|
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'> </td><td>X-value</td></tr>
|
||
|
</table>
|
||
|
|
||
|
<div style="font-weight:bold;font-family:arial;font-size:90%;">Description:</div>Translate X-value into absolute screen coordinates <br>
|
||
|
<div style="font-weight:bold;font-family:arial;font-size:90%;">See also:</div><ul><li><a href="CanvasScale.html#_CANVASSCALE_TRANSLATE">CanvasScale::Translate()</a></ul><p>
|
||
|
<p> <div style='font-family: helvetica, arial, geneva, sans-serif;margin-bottom:4px;border-left:solid black 1px;border-top:solid black 1px;border-bottom:solid black 2px;border-right:solid black 2px;font-size:120%;background:#dde9af;padding:4px;'><a class="no" name="_CANVASSCALE_TRANSLATEY"><span style="color:#555555;">CanvasScale ::</span><br><b>TranslateY</b>($y)</a></div>
|
||
|
|
||
|
<span style='font-family:arial;font-size:95%;'><i>Translate Y-value to absolute screen coordinates</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:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">$y</span>
|
||
|
</span>
|
||
|
|
||
|
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'> </td><td>Y-value</td></tr>
|
||
|
</table>
|
||
|
|
||
|
<div style="font-weight:bold;font-family:arial;font-size:90%;">Description:</div>Translate Y-value to absolute screen coordinates <br>
|
||
|
<div style="font-weight:bold;font-family:arial;font-size:90%;">See also:</div><ul><li><a href="CanvasScale.html#_CANVASSCALE_TRANSLATE">CanvasScale::Translate()</a></ul><p>
|
||
|
<p> <div style='font-family: helvetica, arial, geneva, sans-serif;margin-bottom:4px;border-left:solid black 1px;border-top:solid black 1px;border-bottom:solid black 2px;border-right:solid black 2px;font-size:120%;background:#dde9af;padding:4px;'><a class="no" name="_CANVASSCALE___CONSTRUCT"><span style="color:#555555;">CanvasScale ::</span><br><b>__construct</b>($graph, $xmin, $xmax, $ymin, $ymax)</a></div>
|
||
|
|
||
|
<span style='font-family:arial;font-size:95%;'><i>Define a scale for canvas graphs</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:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">$graph</span>
|
||
|
</span>
|
||
|
|
||
|
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'> </td><td>No description available</td></tr>
|
||
|
|
||
|
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">$xmin</span>
|
||
|
</span>
|
||
|
|
||
|
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">0</span>
|
||
|
</span>
|
||
|
</td><td>Min X-value for scale</td></tr>
|
||
|
|
||
|
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">$xmax</span>
|
||
|
</span>
|
||
|
|
||
|
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">10</span>
|
||
|
</span>
|
||
|
</td><td>Max X-value for scale</td></tr>
|
||
|
|
||
|
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">$ymin</span>
|
||
|
</span>
|
||
|
|
||
|
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">0</span>
|
||
|
</span>
|
||
|
</td><td>Min Y-value for scale</td></tr>
|
||
|
|
||
|
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">$ymax</span>
|
||
|
</span>
|
||
|
|
||
|
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:100%;font-weight:bold;'><span style="color: #000000">
|
||
|
<span style="color: #0000BB">10</span>
|
||
|
</span>
|
||
|
</td><td>Max Y-value for scale</td></tr>
|
||
|
</table>
|
||
|
|
||
|
<div style="font-weight:bold;font-family:arial;font-size:90%;">Description:</div>Define a scale for canvas graphs. Note the scale values is optionally in this call. The may be later set witha call to the Set() method. <br>
|
||
|
<div style="font-weight:bold;font-family:arial;font-size:90%;">See also:</div><ul><li><a href="CanvasScale.html#_CANVASSCALE_SET">CanvasScale::Set()</a></ul><p> <hr> <p></html>
|