| 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="923Explodingpieslices.html">
|
|
|
8 |
<LINK REL="Next" HREF="925Specifyingslicecolorsandusingthemes.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="923Explodingpieslices.html">Previous</A>
|
|
|
26 |
<A HREF="925Specifyingslicecolorsandusingthemes.html">Next</A>
|
|
|
27 |
<HR NOSHADE>
|
|
|
28 |
<H3><A NAME="9_2_4">9.2.4 Specifying and adjusting labels on pie plots</A>
|
|
|
29 |
</H3>
|
|
|
30 |
<P> By default the values shown just outside the pie for each slice are
|
|
|
31 |
the percentage value for each slice. If you instead wanted the absolute
|
|
|
32 |
value you would just have to use the <A href="../ref/PiePlot.html#_PIEPLOT_SETLABELTYPE">
|
|
|
33 |
SetLabelType()</A> method. So to use the absolute value you would call</P>
|
|
|
34 |
<P><DIV class="phpscript"><CODE><FONT color="#000000"> <FONT color="#0000BB">
|
|
|
35 |
$pieplot</FONT><FONT color="#007700">-></FONT><FONT color="#0000BB">
|
|
|
36 |
SetLabelType</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
|
|
|
37 |
"PIE_VALUE_ABS"</FONT><FONT color="#007700">);</FONT><FONT color="#0000BB">
|
|
|
38 |
</FONT></FONT></CODE></DIV></P>
|
|
|
39 |
<P></P>
|
|
|
40 |
<P> Furthermore you could enhance the formatting of the value by either
|
|
|
41 |
using a printf() style format string (using <A href="../ref/DisplayValue.html#_DISPLAYVALUE_SETFORMAT">
|
|
|
42 |
SetFormat()</A> ) or by providing a formatting function callback (using
|
|
|
43 |
<A href="../ref/DisplayValue.html#_DISPLAYVALUE_SETFORMATCALLBACK">
|
|
|
44 |
SetFormatCallback()</A> ) for doing more advanced formatting.</P>
|
|
|
45 |
<P> You can also adjust the position of the labels by means of the <A href="../ref/PiePlot.html#_PIEPLOT_SETLABELPOS">
|
|
|
46 |
PiePlot::SetLabelPos()</A> method. The argument to this method is
|
|
|
47 |
either the fraction of the radius or the string 'auto'. In the latter
|
|
|
48 |
case JpGraph automatically determines the best position and the the
|
|
|
49 |
first case The following example illustrates this<DIV class="example">
|
|
|
50 |
<BR> <A href="exframes/frame_pieex8.html" target="blank"><IMG border="0" HEIGHT="200"
|
|
|
51 |
src="img/pieex8.png" WIDTH="250"></A>
|
|
|
52 |
<BR><B>Figure 127:</B> Example of adjusting the position of the labels
|
|
|
53 |
for the slices <A href="exframes/frame_pieex8.html" target="blank">
|
|
|
54 |
[src]</A>
|
|
|
55 |
<P></P>
|
|
|
56 |
</DIV></P>
|
|
|
57 |
<P></P>
|
|
|
58 |
<P> If this formatting is not enough you can also "manually" specify the
|
|
|
59 |
labels for each slice individually. You do this by using the <A href="../ref/PiePlot.html#_PIEPLOT_SETLABELS">
|
|
|
60 |
PiePLot::SetLabels()</A> method. This will let you specify individual
|
|
|
61 |
text strings for each label. In each specification you can also add a
|
|
|
62 |
printf() formatting specification for a number. The number passed on
|
|
|
63 |
will be either the absolute value for the slice or the percentage value
|
|
|
64 |
depending on what was specified in the call to <A href="../ref/PiePlot.html#_PIEPLOT_SETLABELTYPE">
|
|
|
65 |
SetLabelType()</A></P>
|
|
|
66 |
<P> The SetLabels() method can also take a second parameter, the label
|
|
|
67 |
position parameter. This is just a shortcut to the SetLabelPos() as
|
|
|
68 |
described above. By default the position will be set to 'auto' if not
|
|
|
69 |
explicitely specified.<DIV class="note"><B>Note:</B> The alignment of
|
|
|
70 |
the labels will be different depending on whether they are inside or
|
|
|
71 |
outside the pie. When inside the center of the strings will be aligned
|
|
|
72 |
with the center of the slice at the specified fraction of the radius.
|
|
|
73 |
When positioned outside the alignment will depend on the angle to avoid
|
|
|
74 |
that the labels inadvertely writes over the pie.</DIV></P>
|
|
|
75 |
<HR NOSHADE>
|
|
|
76 |
<A HREF="toc.html">Contents</A>
|
|
|
77 |
<A HREF="923Explodingpieslices.html">Previous</A>
|
|
|
78 |
<A HREF="925Specifyingslicecolorsandusingthemes.html">Next</A>
|
|
|
79 |
</BODY>
|
|
|
80 |
</HTML>
|