| 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="827Usinggroupedaccumulatedbargraphs.html">
|
|
|
8 |
<LINK REL="Next" HREF="829Usinggradientfillforbargraphs.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="827Usinggroupedaccumulatedbargraphs.html">Previous</A>
|
|
|
26 |
<A HREF="829Usinggradientfillforbargraphs.html">Next</A>
|
|
|
27 |
<HR NOSHADE>
|
|
|
28 |
<H3><A NAME="8_2_8">8.2.8 Horizontal bar graphs</A></H3>
|
|
|
29 |
<P> It can often come in handy to have horizontal bar graphs especially
|
|
|
30 |
if you have a large number of values to display. Even though JpGraph
|
|
|
31 |
doesn't directly support horizontal bar graphs this is easy achieved by
|
|
|
32 |
constructing a normal vertical bar graph which is then rotated 90
|
|
|
33 |
degrees.</P>
|
|
|
34 |
<P> The example below shows a simple example of this<DIV class="example">
|
|
|
35 |
<BR> <A href="exframes/frame_horizbarex3.html" target="blank"><IMG border="0"
|
|
|
36 |
HEIGHT="500" src="img/horizbarex3.png" WIDTH="400"></A>
|
|
|
37 |
<BR><B>Figure 40:</B> A typical horizontal bar graph with the Y-axis at
|
|
|
38 |
the bottom <A href="exframes/frame_horizbarex3.html" target="blank">
|
|
|
39 |
[src]</A>
|
|
|
40 |
<P></P>
|
|
|
41 |
</DIV></P>
|
|
|
42 |
<P></P>
|
|
|
43 |
<P> In order to achieve this effect you should study the above example
|
|
|
44 |
carefully and you might notice two things</P>
|
|
|
45 |
<UL>
|
|
|
46 |
<LI> We don't simply rotate the graph we also specify that we want the
|
|
|
47 |
rotation center to be the middle of the entire image. The reason for
|
|
|
48 |
this is that by default (See the section on rotating plots) the pivot
|
|
|
49 |
point for rotation is the center of<STRONG> the plot area</STRONG>.
|
|
|
50 |
Since the center of the plot area is not necessary the center of the
|
|
|
51 |
entire image the rotation might be a little bit difficult to predict
|
|
|
52 |
since it will depend on the margins specified. <</LI>
|
|
|
53 |
<LI> The size of the plot area is determined from the original width and
|
|
|
54 |
height of the image taking the specified margin into account. When the
|
|
|
55 |
the plot area is rotated 90 degrees clockwise what was the left margin
|
|
|
56 |
now in effect become the upper margin and so on. This is a small nuance
|
|
|
57 |
since we conceptually want to specify the margins directly in the
|
|
|
58 |
rotated plot.
|
|
|
59 |
<BR> In order to more easily handle the margin with rotated images it is
|
|
|
60 |
recommended that the method "Set90AndMargin()" is used. This allows the
|
|
|
61 |
image to be rotated as well as specifying the margins in an obvious
|
|
|
62 |
way.</LI>
|
|
|
63 |
</UL>
|
|
|
64 |
<P> We finally show three more examples of horizontal bar plots. In the
|
|
|
65 |
first plot we have hidden the Y-axis and in the second we have
|
|
|
66 |
positioned the Y - axis at top as opposed to the bottom as the first
|
|
|
67 |
example shows.</P>
|
|
|
68 |
<P><DIV class="example">
|
|
|
69 |
<BR> <A href="exframes/frame_horizbarex1.html" target="blank"><IMG border="0"
|
|
|
70 |
HEIGHT="500" src="img/horizbarex1.png" WIDTH="400"></A>
|
|
|
71 |
<BR><B>Figure 41:</B> Horizontal bar graph with hidden Y axis <A href="exframes/frame_horizbarex1.html"
|
|
|
72 |
target="blank">[src]</A>
|
|
|
73 |
<P></P>
|
|
|
74 |
</DIV></P>
|
|
|
75 |
<P><DIV class="example">
|
|
|
76 |
<BR> <A href="exframes/frame_horizbarex2.html" target="blank"><IMG border="0"
|
|
|
77 |
HEIGHT="500" src="img/horizbarex2.png" WIDTH="400"></A>
|
|
|
78 |
<BR><B>Figure 42:</B> Horizontal bar graph with Y axis at the top <A href="exframes/frame_horizbarex2.html"
|
|
|
79 |
target="blank">[src]</A>
|
|
|
80 |
<P></P>
|
|
|
81 |
</DIV></P>
|
|
|
82 |
<P></P>
|
|
|
83 |
<P> In the final example which is almost similar to the two first we
|
|
|
84 |
illustrate the use of labels with more than one line.<DIV class="example">
|
|
|
85 |
<BR> <A href="exframes/frame_horizbarex4.html" target="blank"><IMG border="0"
|
|
|
86 |
HEIGHT="500" src="img/horizbarex4.png" WIDTH="400"></A>
|
|
|
87 |
<BR><B>Figure 43:</B> Horizontal bar graph with manual integer scale as
|
|
|
88 |
well as multiple line labels <A href="exframes/frame_horizbarex4.html" target="blank">
|
|
|
89 |
[src]</A>
|
|
|
90 |
<P></P>
|
|
|
91 |
</DIV></P>
|
|
|
92 |
<P></P>
|
|
|
93 |
<HR NOSHADE>
|
|
|
94 |
<A HREF="toc.html">Contents</A>
|
|
|
95 |
<A HREF="827Usinggroupedaccumulatedbargraphs.html">Previous</A>
|
|
|
96 |
<A HREF="829Usinggradientfillforbargraphs.html">Next</A>
|
|
|
97 |
</BODY>
|
|
|
98 |
</HTML>
|