| 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="726Usingaccumulatedbarplots.html">
|
|
|
8 |
<LINK REL="Next" HREF="728Horizontalbargraphs.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="726Usingaccumulatedbarplots.html">Previous</A>
|
|
|
26 |
<A HREF="728Horizontalbargraphs.html">Next</A>
|
|
|
27 |
<HR NOSHADE>
|
|
|
28 |
<H3><A NAME="7_2_7">7.2.7 Using grouped accumulated bar graphs</A></H3>
|
|
|
29 |
<P> It is perfectly possible to combine the previous bar types to have
|
|
|
30 |
grouped accumulated bar plots. This is done by just adding the
|
|
|
31 |
different accumulated plots to a group bar plot, for example the
|
|
|
32 |
following code would do that.<DIV class="phpscript"><CODE><FONT color="#000000">
|
|
|
33 |
<FONT color="#0000BB"> </FONT><FONT color="#FF8000">
|
|
|
34 |
// Create all the 4 bar plots
|
|
|
35 |
<BR></FONT><FONT color="#0000BB">$b1plot </FONT><FONT color="#007700">
|
|
|
36 |
= new </FONT><FONT color="#0000BB">BarPlot</FONT><FONT color="#007700">(</FONT><FONT
|
|
|
37 |
color="#0000BB">$data1y</FONT><FONT color="#007700">);
|
|
|
38 |
<BR></FONT><FONT color="#0000BB">$b1plot</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
39 |
color="#0000BB">SetFillColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
|
|
|
40 |
"orange"</FONT><FONT color="#007700">);
|
|
|
41 |
<BR></FONT><FONT color="#0000BB">$b2plot </FONT><FONT color="#007700">
|
|
|
42 |
= new </FONT><FONT color="#0000BB">BarPlot</FONT><FONT color="#007700">(</FONT><FONT
|
|
|
43 |
color="#0000BB">$data2y</FONT><FONT color="#007700">);
|
|
|
44 |
<BR></FONT><FONT color="#0000BB">$b2plot</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
45 |
color="#0000BB">SetFillColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
|
|
|
46 |
"blue"</FONT><FONT color="#007700">);
|
|
|
47 |
<BR></FONT><FONT color="#0000BB">$b3plot </FONT><FONT color="#007700">
|
|
|
48 |
= new </FONT><FONT color="#0000BB">BarPlot</FONT><FONT color="#007700">(</FONT><FONT
|
|
|
49 |
color="#0000BB">$data3y</FONT><FONT color="#007700">);
|
|
|
50 |
<BR></FONT><FONT color="#0000BB">$b3plot</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
51 |
color="#0000BB">SetFillColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
|
|
|
52 |
"green"</FONT><FONT color="#007700">);
|
|
|
53 |
<BR></FONT><FONT color="#0000BB">$b4plot </FONT><FONT color="#007700">
|
|
|
54 |
= new </FONT><FONT color="#0000BB">BarPlot</FONT><FONT color="#007700">(</FONT><FONT
|
|
|
55 |
color="#0000BB">$data4y</FONT><FONT color="#007700">);
|
|
|
56 |
<BR></FONT><FONT color="#0000BB">$b4plot</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
57 |
color="#0000BB">SetFillColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">
|
|
|
58 |
"brown"</FONT><FONT color="#007700">);
|
|
|
59 |
<BR>
|
|
|
60 |
<BR></FONT><FONT color="#FF8000">// Create the accumulated bar plots
|
|
|
61 |
<BR></FONT><FONT color="#0000BB">$ab1plot </FONT><FONT color="#007700">
|
|
|
62 |
= new </FONT><FONT color="#0000BB">AccBarPlot</FONT><FONT color="#007700">
|
|
|
63 |
(array(</FONT><FONT color="#0000BB">$b1plot</FONT><FONT color="#007700">
|
|
|
64 |
,</FONT><FONT color="#0000BB">$b2plot</FONT><FONT color="#007700">));
|
|
|
65 |
<BR></FONT><FONT color="#0000BB">$ab2plot </FONT><FONT color="#007700">
|
|
|
66 |
= new </FONT><FONT color="#0000BB">AccBarPlot</FONT><FONT color="#007700">
|
|
|
67 |
(array(</FONT><FONT color="#0000BB">$b3plot</FONT><FONT color="#007700">
|
|
|
68 |
,</FONT><FONT color="#0000BB">$b4plot</FONT><FONT color="#007700">));
|
|
|
69 |
<BR>
|
|
|
70 |
<BR></FONT><FONT color="#FF8000">// Create the grouped bar plot
|
|
|
71 |
<BR></FONT><FONT color="#0000BB">$gbplot </FONT><FONT color="#007700">
|
|
|
72 |
= new </FONT><FONT color="#0000BB">GroupBarPlot</FONT><FONT color="#007700">
|
|
|
73 |
(array(</FONT><FONT color="#0000BB">$ab1plot</FONT><FONT color="#007700">
|
|
|
74 |
,</FONT><FONT color="#0000BB">$ab2plot</FONT><FONT color="#007700">));
|
|
|
75 |
<BR>
|
|
|
76 |
<BR></FONT><FONT color="#FF8000">// ...and add it to the graph
|
|
|
77 |
<BR></FONT><FONT color="#0000BB">$graph</FONT><FONT color="#007700">-></FONT><FONT
|
|
|
78 |
color="#0000BB">Add</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">
|
|
|
79 |
$gbplot</FONT><FONT color="#007700">);</FONT><FONT color="#0000BB"></FONT>
|
|
|
80 |
</FONT></CODE></DIV></P>
|
|
|
81 |
<P> Putting this together in an example would then produce the graph as
|
|
|
82 |
shown below<DIV class="example">
|
|
|
83 |
<BR> <A href="exframes/frame_example24.html" target="blank"><IMG border="0"
|
|
|
84 |
HEIGHT="200" src="img/img/img/img/img/img/example24.png" WIDTH="310"></A>
|
|
|
85 |
<BR><B>Figure 43:</B> Combining grouped and accumulated bar plots <A href="exframes/frame_example24.html"
|
|
|
86 |
target="blank">[src]</A>
|
|
|
87 |
<P></P>
|
|
|
88 |
</DIV></P>
|
|
|
89 |
<P></P>
|
|
|
90 |
<HR NOSHADE>
|
|
|
91 |
<A HREF="toc.html">Contents</A>
|
|
|
92 |
<A HREF="726Usingaccumulatedbarplots.html">Previous</A>
|
|
|
93 |
<A HREF="728Horizontalbargraphs.html">Next</A>
|
|
|
94 |
</BODY>
|
|
|
95 |
</HTML>
|