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="7102Specifyingadatetimescalewithamanualcallback.html">
8
<LINK REL="Next" HREF="712Addingarbitrarytextstringstothegraph.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="7102Specifyingadatetimescalewithamanualcallback.html">Previous</A>
26
<A HREF="712Addingarbitrarytextstringstothegraph.html">Next</A>
27
<HR NOSHADE>
28
<H2><A NAME="7_11">7.11 Adjusting labels on a text scale</A></H2>
29
<P> In the following section we will work through an number of examples
30
 on how to manipulate labels on a text scale. Primarily we will
31
 investigate how to best handle the case where you have a large number
32
 of values.</P>
33
<P> As a remainder; Text scale is meant to be used on the X-axis when
34
 the X-axis doesn't have a numeric value, i.e you are only interested in
35
 linear ordering of the data. If you don't specify the labels manually
36
 they will be set automatically starting from 1 as the example below
37
 shows.</P>
38
<P><DIV class="example">
39
<BR> <A href="exframes/frame_bartutex1.html" target="blank"><IMG border="0"
40
HEIGHT="200"       src="img/img/img/img/img/img/bartutex1.png" WIDTH="300"></A>
41
<BR><B>Figure 83:</B> A simple bar plot using an automatic text scale <A href="exframes/frame_bartutex1.html"
42
target="blank">[src]</A>&nbsp;
43
<P></P>
44
</DIV></P>
45
<P></P>
46
<P> To specify the labels on the X-axis as suitable text strings you
47
 call the method <A href="../ref/Axis.html#_AXIS_SETTICKLABELS">
48
 Axis::SetTickLabels()</A> with an array containing the text-labels. If
49
 there are more data points than labels the non-specified labels will be
50
 given their ordinal number. If we augment the previous example with the
51
 name of the month we get the following new example</P>
52
<P><DIV class="example">
53
<BR> <A href="exframes/frame_bartutex2.html" target="blank"><IMG border="0"
54
HEIGHT="200"       src="img/img/img/img/img/img/bartutex2.png" WIDTH="300"></A>
55
<BR><B>Figure 84:</B> Manually specifying the text scale labels <A href="exframes/frame_bartutex2.html"
56
target="blank">[src]</A>&nbsp;
57
<P></P>
58
</DIV></P>
59
<P></P>
60
<P></P>
61
<HR> <SMALL><STRONG> Tip:</STRONG> To get hold of localized version of
62
 the month names (or weekdays) you can use the <A href="../ref/DateLocale.html#_C_DATELOCALE">
63
 DateLocal</A> class available in the global variable $gDateLocale If no
64
 locale has been specified the default locale for the installation will
65
 be used.</SMALL>
66
<HR>
67
<P> What happen now if we have a larger number of bars? Let's try with
68
 25 bars and see what result we get.</P>
69
<P><DIV class="example">
70
<BR> <A href="exframes/frame_bartutex3.html" target="blank"><IMG border="0"
71
HEIGHT="200"       src="img/img/img/img/img/img/bartutex3.png" WIDTH="300"></A>
72
<BR><B>Figure 85:</B> A larger data set <A href="exframes/frame_bartutex3.html"
73
target="blank">[src]</A>&nbsp;
74
<P></P>
75
</DIV></P>
76
<P></P>
77
<P> Not all to impressive. The labels are to close and they overlap.
78
 Hence it is not a good idea to display every label. To adjust what
79
 labels are to be displayed you use the <A href="../ref/Axis.html#_AXIS_SETTEXTLABELINTERVAL">
80
 SetTextLabelInterval()</A> method. The argument to this method is the
81
 interval between text labels. So to display only every 3 month you
82
 would add the line</P>
83
<P><DIV class="phpscript"><CODE><FONT color="#000000"> <FONT color="#0000BB">
84
&nbsp;$graph</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">xaxis</FONT><FONT
85
color="#007700">-&gt;</FONT><FONT color="#0000BB">SetTextLabelIntervall</FONT><FONT
86
color="#007700">(</FONT><FONT color="#0000BB">3</FONT><FONT color="#007700">
87
)</FONT><FONT color="#0000BB"></FONT></FONT></CODE></DIV></P>
88
<P></P>
89
<P> Which would give the result shown below<DIV class="example">
90
<BR> <A href="exframes/frame_bartutex4.html" target="blank"><IMG border="0"
91
HEIGHT="200"       src="img/img/img/img/img/img/bartutex4.png" WIDTH="300"></A>
92
<BR><B>Figure 86:</B> Displaying only every third label <A href="exframes/frame_bartutex4.html"
93
target="blank">[src]</A>&nbsp;
94
<P></P>
95
</DIV></P>
96
<P></P>
97
<P> Much better, quite readable.</P>
98
<P> If we have an even larger data set it might not longer be meaningful
99
 to display all the tick marks since they would simple become to close.
100
 In JpGraph there is a possibility to specify that you only would like
101
 every<I> n</I>:th tick mark to be visible ( <A href="../ref/Axis.html#_AXIS_SETTEXTTICKINTERVAL">
102
 SetTextTickIntervall()</A> ). For bar graphs using text scale however,
103
 that might not be such a good idea since the tick marks are between the
104
 bars and the labels centered under the bars. If we only were to
105
 display, say, every 3 tick mark it wouldn't look to good. Not that we
106
 can't do it, as the example below shows, but it just doesn't look very
107
 good.<DIV class="example">
108
<BR> <A href="exframes/frame_bartutex5.html" target="blank"><IMG border="0"
109
HEIGHT="200"       src="img/img/img/img/img/img/bartutex5.png" WIDTH="300"></A>
110
<BR><B>Figure 87:</B> Displaying just every third tick mark. <A href="exframes/frame_bartutex5.html"
111
target="blank">[src]</A>&nbsp;
112
<P></P>
113
</DIV></P>
114
<P></P>
115
<P> A better way to handle large data set is simply to hide the tick
116
 marks all together. Tick marks may be hidden by calling the method <A href="../ref/Axis.html#_AXIS_HIDETICKS">
117
 Axis::HideTicks(); <A> If we hide all the ticks on the X-axis we will
118
 get the result shown below<DIV class="example">
119
<BR> <A href="exframes/frame_bartutex6.html" target="blank"><IMG border="0"
120
HEIGHT="200"       src="img/img/img/img/img/img/bartutex6.png" WIDTH="300"></A>
121
<BR><B>Figure 88:</B> Hiding all tick mark. <A href="exframes/frame_bartutex6.html"
122
target="blank">[src]</A>&nbsp;
123
<P></P>
124
</DIV></A></A></P>
125
<P></P>
126
<HR NOSHADE>
127
<A HREF="toc.html">Contents</A>
128
<A HREF="7102Specifyingadatetimescalewithamanualcallback.html">Previous</A>
129
<A HREF="712Addingarbitrarytextstringstothegraph.html">Next</A>
130
</BODY>
131
</HTML>