Blame | Letzte Änderung | Log anzeigen | RSS feed
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1"><LINK REL="Start" HREF="index.html"><LINK REL="Contents" HREF="toc.html"><LINK REL="Prev" HREF="8195InvertingtheYaxis.html"><LINK REL="Next" HREF="821Addingbandsofpatternandcolortographs.html"><STYLE TYPE="text/css"><!--BODY { font-family: serif }H1 { font-family: sans-serif }H2 { font-family: sans-serif }H3 { font-family: sans-serif }H4 { font-family: sans-serif }H5 { font-family: sans-serif }H6 { font-family: sans-serif }SUB { font-size: smaller }SUP { font-size: smaller }PRE { font-family: monospace }A { text-decoration: none }--></STYLE></HEAD><BODY><A HREF="toc.html">Contents</A><A HREF="8195InvertingtheYaxis.html">Previous</A><A HREF="821Addingbandsofpatternandcolortographs.html">Next</A><HR NOSHADE><H2><A NAME="8_20">8.20 Adjusting the auto-scaling limits - grace value</A></H2><P> By default the auto-scaling algorithm tries to make best possibleuse of screen estate by making the scale as large as possible, i.e. theextreme values (min/max) will be on the top and bottom of the scale ifthey happen to fall on a scale-tick. So for example doing a simple lineplot could look like the plot shown in the below.<DIV class="example"><BR> <A href="exframes/frame_example3.2.html" target="blank"><IMG border="0"HEIGHT="200" src="img/example3.2.png" WIDTH="300"></A><BR><B>Figure 96:</B> A typical graph with autoscaling and grace=0 <A href="exframes/frame_example3.2.html"target="blank">[src]</A> <P></P></DIV></P><P> However you might sometime want to add some extra to the minimum andmaximum values so that there is some "air" in the graph between the endof the scale values and the extreme points in the graphs. This can bedone by adding a "grace" percentage to the scale. So for example adding10% to the y-scale in the image above is done by calling the <A href="../ref/LinearScale.html#_LINEARSCALE_SETGRACE">SetGrace()</A> method on the yscale as in</P><P><DIV class="phpscript"><CODE><FONT color="#000000"> <FONT color="#0000BB"> $graph</FONT><FONT color="#007700">-></FONT><FONT color="#0000BB">yaxis</FONT><FONTcolor="#007700">-></FONT><FONT color="#0000BB">scale</FONT><FONT color="#007700">-></FONT><FONT color="#0000BB">SetGrace</FONT><FONT color="#007700">(</FONT><FONTcolor="#0000BB">10</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">10</FONT><FONT color="#007700">);</FONT><FONT color="#0000BB"></FONT></FONT></CODE></DIV></P><P> These lines add a minimum of 10% to the top and bottom values of thescale. Note that we say "minimum" since depending on the specific tickvalues choose this might be a little bit more to make the end of thescale fall on an even tick mark.</P><P> Adding this line to the previous graph will result in the followingexample</P><P><DIV class="example"><BR> <A href="exframes/frame_example3.2.1.html" target="blank"><IMG border="0"HEIGHT="200" src="img/example3.2.1.png" WIDTH="300"></A><BR><B>Figure 97:</B> Adding 10% grace value to top and bottom of theY-scale <A href="exframes/frame_example3.2.1.html" target="blank">[src]</A> <P></P></DIV></P><P> Since we haven't adjusted the position of the X-axis it will remainat Y=0 which might not necessary be what we would like so we thereforalso add the line</P><P><DIV class="phpscript"><CODE><FONT color="#000000"> <FONT color="#0000BB"> $graph</FONT><FONT color="#007700">-></FONT><FONT color="#0000BB">xaxis</FONT><FONTcolor="#007700">-></FONT><FONT color="#0000BB">SetPos</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">"min"</FONT><FONT color="#007700">);</FONT><FONTcolor="#0000BB"></FONT></FONT></CODE></DIV></P><P></P><P> So that the X-axis always will remain at the lowest possibleY-value. Doing this will then result in the example below</P><P><DIV class="example"><BR> <A href="exframes/frame_example3.2.2.html" target="blank"><IMG border="0"HEIGHT="200" src="img/example3.2.2.png" WIDTH="300"></A><BR><B>Figure 98:</B> Using grace but also adjusting the position of theX-axis <A href="exframes/frame_example3.2.2.html" target="blank">[src]</A> <P></P></DIV></P><P></P><HR NOSHADE><A HREF="toc.html">Contents</A><A HREF="8195InvertingtheYaxis.html">Previous</A><A HREF="821Addingbandsofpatternandcolortographs.html">Next</A></BODY></HTML>