Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
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="721Adjustingthewidthofthebars.html">
8
<LINK REL="Next" HREF="723Addingadropshadowtothebar.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="721Adjustingthewidthofthebars.html">Previous</A>
26
<A HREF="723Addingadropshadowtothebar.html">Next</A>
27
<HR NOSHADE>
28
<H3><A NAME="7_2_2">7.2.2 Displaying the value of each bar</A></H3>
29
<P> You can easily choose to display the value (and it's format) on top
30
 of each bar by accessing the bar's 'value' property. So for example by
31
 just adding the line<DIV class="phpscript"><CODE><FONT color="#000000">
32
 <FONT color="#0000BB">&nbsp;$barplot</FONT><FONT color="#007700">-&gt;</FONT><FONT
33
color="#0000BB">value</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">
34
Show</FONT><FONT color="#007700">();</FONT><FONT color="#0000BB"></FONT></FONT>
35
</CODE></DIV></P>
36
<P> Will enable the values in it's simplest form and will give the
37
 result<DIV class="example">
38
<BR> <A href="exframes/frame_example20.1.html" target="blank"><IMG border="0"
39
HEIGHT="200"       src="img/img/img/img/img/img/example20.1.png" WIDTH="300"></A>
40
<BR><B>Figure 35:</B> Showing the values for each bar <A href="exframes/frame_example20.1.html"
41
target="blank">[src]</A>&nbsp;
42
<P></P>
43
</DIV></P>
44
<P> You cane see a small nuisance in this graph. The auto scaling
45
 algorithm chooses quite tight limits for the scale so that the bars
46
 just fit. Adding the value on top of the bar makes it collide with the
47
 top of the graph. To remedy this we tell the auto scaling algorithm to
48
 allow for more &quot;grace&quot; space at the top of the scale by using the
49
 method <A href="../ref/LinearScale.html#_LINEARSCALE_SETGRACE">
50
 SetGrace()</A> which is used to tell the scale to add a percentage (of
51
 the total scale span) more space to either one end or both ends of the
52
 scale. In this case we add 20% more space at the top to make more room
53
 for the values with the line<DIV class="phpscript"><CODE><FONT color="#000000">
54
 <FONT color="#0000BB">&nbsp;$graph</FONT><FONT color="#007700">-&gt;</FONT><FONT
55
color="#0000BB">yaxis</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">
56
scale</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">
57
SetGrace</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">20</FONT><FONT
58
color="#007700">);</FONT><FONT color="#0000BB"></FONT></FONT></CODE></DIV>
59
</P>
60
<P></P>
61
<P> This will then give the graph as shown below<DIV class="example">
62
<BR> <A href="exframes/frame_example20.2.html" target="blank"><IMG border="0"
63
HEIGHT="200"       src="img/img/img/img/img/img/example20.2.png" WIDTH="300"></A>
64
<BR><B>Figure 36:</B> Adding some grace space to the top of the Y-scale <A
65
href="exframes/frame_example20.2.html" target="blank">[src]</A>&nbsp;
66
<P></P>
67
</DIV></P>
68
<P></P>
69
<P> You can also adjust the general position of the value in respect to
70
 the bar by using the <A href="../ref/BarPlot.html#_BARPLOT_SETVALUEPOS">
71
 BarPlot::SetValuePos()</A> method. You can set the position to either
72
 'top' (the default) , 'center' or 'bottom'. The graph below shows the
73
 value being positioned in the center. In this example we have also
74
 adjusted the format to just display the value as an integer without any
75
 decimals.<DIV class="example">
76
<BR> <A href="exframes/frame_example20.5.html" target="blank"><IMG border="0"
77
HEIGHT="200"       src="img/img/img/img/img/img/example20.5.png" WIDTH="300"></A>
78
<BR><B>Figure 37:</B> Putting the values in the middle of the bar. <A href="exframes/frame_example20.5.html"
79
target="blank">[src]</A>&nbsp;
80
<P></P>
81
</DIV></P>
82
<P> It is also possible to specify a more fine grained control on how
83
 you want the values presented. You can for example, rotate them, change
84
 font, change color. It is also possible to adjust the actual value
85
 displayed by either using a printf()-type format string or with the
86
 more advanced technique of a format callback routine.</P>
87
<P> To show what you can do we just give another example for you to
88
 examine without much further explanations. Just remember that to have
89
 text at an angle other than 0 or 90 degrees we have to use TTF fonts.
90
 Even though we haven't explained the SetFont() method it should be
91
 fairly obvious.<DIV class="example">
92
<BR> <A href="exframes/frame_example20.3.html" target="blank"><IMG border="0"
93
HEIGHT="200"       src="img/img/img/img/img/img/example20.3.png" WIDTH="300"></A>
94
<BR><B>Figure 38:</B> Making the displayed values more interesting <A href="exframes/frame_example20.3.html"
95
target="blank">[src]</A>&nbsp;
96
<P></P>
97
</DIV></P>
98
<P></P>
99
<HR NOSHADE>
100
<A HREF="toc.html">Contents</A>
101
<A HREF="721Adjustingthewidthofthebars.html">Previous</A>
102
<A HREF="723Addingadropshadowtothebar.html">Next</A>
103
</BODY>
104
</HTML>