| 1 |
lars |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
|
|
2 |
<HTML>
|
|
|
3 |
<HEAD>
|
|
|
4 |
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
|
|
|
5 |
<LINK REL="Start" HREF="index.html">
|
|
|
6 |
<LINK REL="Contents" HREF="toc.html">
|
|
|
7 |
<LINK REL="Prev" HREF="77Combiningdifferentgraphtypes.html">
|
|
|
8 |
<LINK REL="Next" HREF="79Adjustingtheautomatictickmarks.html">
|
|
|
9 |
<STYLE TYPE="text/css"><!--
|
|
|
10 |
BODY { font-family: serif }
|
|
|
11 |
H1 { font-family: sans-serif }
|
|
|
12 |
H2 { font-family: sans-serif }
|
|
|
13 |
H3 { font-family: sans-serif }
|
|
|
14 |
H4 { font-family: sans-serif }
|
|
|
15 |
H5 { font-family: sans-serif }
|
|
|
16 |
H6 { font-family: sans-serif }
|
|
|
17 |
SUB { font-size: smaller }
|
|
|
18 |
SUP { font-size: smaller }
|
|
|
19 |
PRE { font-family: monospace }
|
|
|
20 |
A { text-decoration: none }
|
|
|
21 |
--></STYLE>
|
|
|
22 |
</HEAD>
|
|
|
23 |
<BODY>
|
|
|
24 |
<A HREF="toc.html">Contents</A>
|
|
|
25 |
<A HREF="77Combiningdifferentgraphtypes.html">Previous</A>
|
|
|
26 |
<A HREF="79Adjustingtheautomatictickmarks.html">Next</A>
|
|
|
27 |
<HR NOSHADE>
|
|
|
28 |
<H2><A NAME="7_8">7.8 Specifying the scale manually</A></H2>
|
|
|
29 |
<P> Normally the automatic scaling should be doing an adequate job in
|
|
|
30 |
most circumstances but there might be cases where you like to manually
|
|
|
31 |
set the scale. For example if you have several graphs where you like to
|
|
|
32 |
be able to easily compare them and therefore want them all to have the
|
|
|
33 |
same scale.</P>
|
|
|
34 |
<P> To specify a manual scale you have to add arguments to the standard <A
|
|
|
35 |
href="../ref/Graph.html#_GRAPH_SETSCALE"> Graph::SetScale()</A> method.
|
|
|
36 |
So to specify that you want an Y-scale between 0 and 100 you need to
|
|
|
37 |
write<DIV class="phpscript"><CODE><FONT color="#000000"> <FONT color="#0000BB">
|
|
|
38 |
$graph</FONT><FONT color="#007700">-></FONT><FONT color="#0000BB">
|
|
|
39 |
SetScale</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
|
|
|
40 |
"textlin"</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">0</FONT><FONT
|
|
|
41 |
color="#007700">,</FONT><FONT color="#0000BB">100</FONT><FONT color="#007700">
|
|
|
42 |
);</FONT><FONT color="#0000BB"></FONT></FONT></CODE></DIV></P>
|
|
|
43 |
<P>When you specify a scale manually there is one additional thing you
|
|
|
44 |
need to decide. How the tick marks should be positioned. You have three
|
|
|
45 |
choices</P>
|
|
|
46 |
<OL>
|
|
|
47 |
<LI> Let JpGraph decide suitable tick marks honoring the exact scale you
|
|
|
48 |
specified.<B> This is the default behavior</B> if you don't do anything
|
|
|
49 |
else.</LI>
|
|
|
50 |
<LI> Allow JpGraph to slightly adjust your specified min and max values.
|
|
|
51 |
With the default method, depending on the min and max values, the end
|
|
|
52 |
and start of the scale might not fall on an exact tick mark. For
|
|
|
53 |
esthetic reasons you might still want the last/first tick mark to fall
|
|
|
54 |
on the edges of the scale. By calling <A href="../ref/LinearScale.html#_LINEARSCALE_SETAUTOTICKS">
|
|
|
55 |
LinearScale::SetAutoTicks()</A> you tell JpGraph to make the smallest
|
|
|
56 |
necessary adjustment of the end/start points so that they fall on an
|
|
|
57 |
exact tick mark.</LI>
|
|
|
58 |
<LI> Manually specify the tick marks with a call to <A href="../ref/LinearTicks.html#_LINEARTICKS_SET">
|
|
|
59 |
LinearTicks::Set()</A> For example<DIV class="phpscript"><CODE><FONT color="#000000">
|
|
|
60 |
<FONT color="#0000BB"> $graph</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
61 |
color="#0000BB">SetScale</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
|
|
|
62 |
"textlin"</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">0</FONT><FONT
|
|
|
63 |
color="#007700">,</FONT><FONT color="#0000BB">100</FONT><FONT color="#007700">
|
|
|
64 |
);
|
|
|
65 |
<BR></FONT><FONT color="#0000BB">$graph</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
66 |
color="#0000BB">yscale</FONT><FONT color="#007700">-></FONT><FONT color="#0000BB">
|
|
|
67 |
ticks</FONT><FONT color="#007700">-></FONT><FONT color="#0000BB">Set</FONT><FONT
|
|
|
68 |
color="#007700">(</FONT><FONT color="#0000BB">10</FONT><FONT color="#007700">
|
|
|
69 |
,</FONT><FONT color="#0000BB">5</FONT><FONT color="#007700">);</FONT><FONT
|
|
|
70 |
color="#0000BB"></FONT></FONT></CODE></DIV>
|
|
|
71 |
<P>Will set the major tick marks every at 0,10,20,.. And every minor
|
|
|
72 |
tick mark in between (0,5,10,15,20,25,...).</P>
|
|
|
73 |
</LI>
|
|
|
74 |
</OL>
|
|
|
75 |
<P> The three images below illustrates the difference between the
|
|
|
76 |
possibilities of ticks for a manual scale.<DIV class="example">
|
|
|
77 |
<BR> <A href="exframes/frame_manscaleex1.html" target="blank"><IMG border="0"
|
|
|
78 |
HEIGHT="200" src="img/img/img/img/img/img/manscaleex1.png" WIDTH="220"></A>
|
|
|
79 |
<BR><B>Figure 76:</B> Manual scale, manual ticks major=7 minor=2 <A href="exframes/frame_manscaleex1.html"
|
|
|
80 |
target="blank">[src]</A>
|
|
|
81 |
<P></P>
|
|
|
82 |
</DIV></P>
|
|
|
83 |
<P></P>
|
|
|
84 |
<P><DIV class="example">
|
|
|
85 |
<BR> <A href="exframes/frame_manscaleex4.html" target="blank"><IMG border="0"
|
|
|
86 |
HEIGHT="200" src="img/img/img/img/img/img/manscaleex4.png" WIDTH="220"></A>
|
|
|
87 |
<BR><B>Figure 77:</B> Manual scale, automatic ticks with exact limits <A href="exframes/frame_manscaleex4.html"
|
|
|
88 |
target="blank">[src]</A>
|
|
|
89 |
<P></P>
|
|
|
90 |
</DIV></P>
|
|
|
91 |
<P></P>
|
|
|
92 |
<P><DIV class="example">
|
|
|
93 |
<BR> <A href="exframes/frame_manscaleex2.html" target="blank"><IMG border="0"
|
|
|
94 |
HEIGHT="200" src="img/img/img/img/img/img/manscaleex2.png" WIDTH="220"></A>
|
|
|
95 |
<BR><B>Figure 78:</B> Manual scale, automatic ticks where we allow
|
|
|
96 |
adjustments of the limits <A href="exframes/frame_manscaleex2.html" target="blank">
|
|
|
97 |
[src]</A>
|
|
|
98 |
<P></P>
|
|
|
99 |
</DIV></P>
|
|
|
100 |
<P></P>
|
|
|
101 |
<HR NOSHADE>
|
|
|
102 |
<A HREF="toc.html">Contents</A>
|
|
|
103 |
<A HREF="77Combiningdifferentgraphtypes.html">Previous</A>
|
|
|
104 |
<A HREF="79Adjustingtheautomatictickmarks.html">Next</A>
|
|
|
105 |
</BODY>
|
|
|
106 |
</HTML>
|