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="7111Usingfilledgridlines.html">
8
<LINK REL="Next" HREF="7113Adjustingtheticksonatextscale.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="7111Usingfilledgridlines.html">Previous</A>
26
<A HREF="7113Adjustingtheticksonatextscale.html">Next</A>
27
<HR NOSHADE>
28
<H3><A NAME="7_1_12">7.1.12 Specifying text labels for the X-axis</A></H3>
29
<P> You might want to have specific labels you want to use for the
30
 X-axis when this has been specified as a &quot;text&quot; scale. In the previous
31
 example each Y-point might represent a specific measurement for each of
32
 the first 10 month. We might then want to display the name of the
33
 months as X-scale.</P>
34
<P> To specify the labels on the scale you make use of the <A href="../ref/Axis.html#_AXIS_SETTICKLABELS">
35
 SetTickLabels()</A> method.</P>
36
<P> To get a localized version of the name of the month you can use a
37
 nice feature in JpGraph, the global '$gDateLocal' object which is an
38
 instance of the <A href="../ref/DateLocale.html#_C_DATELOCALE">
39
 DateLocale</A></P>
40
<P> This class has a number of methods to get localized versions of
41
 relevant names for dates, (months and weekdays).</P>
42
<P> So to specify the X-axis with the short form of the month names we
43
 use the construction<DIV class="phpscript"><CODE><FONT color="#000000">
44
 <FONT color="#0000BB">&nbsp;$a&nbsp;</FONT><FONT color="#007700">=&nbsp;</FONT><FONT color="#0000BB">
45
$gDateLocale</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">
46
GetShortMonth</FONT><FONT color="#007700">();
47
<BR></FONT><FONT color="#0000BB">$graph</FONT><FONT color="#007700">-&gt;</FONT><FONT
48
color="#0000BB">xaxis</FONT><FONT color="#007700">-&gt;</FONT><FONT color="#0000BB">
49
SetTickLabels</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
50
$a</FONT><FONT color="#007700">);</FONT><FONT color="#0000BB"></FONT></FONT>
51
</CODE></DIV></P>
52
<P> This will, now result in the image displayed below<DIV class="example">
53
<BR> <A href="exframes/frame_example9.html" target="blank"><IMG border="0"
54
HEIGHT="200"       src="img/img/img/img/img/img/example9.png" WIDTH="350"></A>
55
<BR><B>Figure 22:</B> Specifying text labels for the X-axis <A href="exframes/frame_example9.html"
56
target="blank">[src]</A>&nbsp;
57
<P></P>
58
</DIV></P>
59
<P><DIV class="note"><B>Note:</B> It is also perfectly legal to override
60
 the default labels for the Y (and Y2) axis in the same way, however
61
 there is seldom need for that. Please note that the supplied labels
62
 will be applied to each major tick label. If there are insufficient
63
 number of supplied labels the non-existent positions will have empty
64
 labels.</DIV></P>
65
<HR NOSHADE>
66
<A HREF="toc.html">Contents</A>
67
<A HREF="7111Usingfilledgridlines.html">Previous</A>
68
<A HREF="7113Adjustingtheticksonatextscale.html">Next</A>
69
</BODY>
70
</HTML>