Blame | Letzte Änderung | Log anzeigen | RSS feed
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1"><LINK REL="Start" HREF="index.html"><LINK REL="Contents" HREF="toc.html"><LINK REL="Prev" HREF="826Usingaccumulatedbarplots.html"><LINK REL="Next" HREF="828Horizontalbargraphs.html"><STYLE TYPE="text/css"><!--BODY { font-family: serif }H1 { font-family: sans-serif }H2 { font-family: sans-serif }H3 { font-family: sans-serif }H4 { font-family: sans-serif }H5 { font-family: sans-serif }H6 { font-family: sans-serif }SUB { font-size: smaller }SUP { font-size: smaller }PRE { font-family: monospace }A { text-decoration: none }--></STYLE></HEAD><BODY><A HREF="toc.html">Contents</A><A HREF="826Usingaccumulatedbarplots.html">Previous</A><A HREF="828Horizontalbargraphs.html">Next</A><HR NOSHADE><H3><A NAME="8_2_7">8.2.7 Using grouped accumulated bar graphs</A></H3><P> It is perfectly possible to combine the previous bar types to havegrouped accumulated bar plots. This is done by just adding thedifferent accumulated plots to a group bar plot, for example thefollowing code would do that.<DIV class="phpscript"><CODE><FONT color="#000000"><FONT color="#0000BB"> </FONT><FONT color="#FF8000">// Create all the 4 bar plots<BR></FONT><FONT color="#0000BB">$b1plot </FONT><FONT color="#007700">= new </FONT><FONT color="#0000BB">BarPlot</FONT><FONT color="#007700">(</FONT><FONTcolor="#0000BB">$data1y</FONT><FONT color="#007700">);<BR></FONT><FONT color="#0000BB">$b1plot</FONT><FONT color="#007700">-></FONT><FONTcolor="#0000BB">SetFillColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">"orange"</FONT><FONT color="#007700">);<BR></FONT><FONT color="#0000BB">$b2plot </FONT><FONT color="#007700">= new </FONT><FONT color="#0000BB">BarPlot</FONT><FONT color="#007700">(</FONT><FONTcolor="#0000BB">$data2y</FONT><FONT color="#007700">);<BR></FONT><FONT color="#0000BB">$b2plot</FONT><FONT color="#007700">-></FONT><FONTcolor="#0000BB">SetFillColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">"blue"</FONT><FONT color="#007700">);<BR></FONT><FONT color="#0000BB">$b3plot </FONT><FONT color="#007700">= new </FONT><FONT color="#0000BB">BarPlot</FONT><FONT color="#007700">(</FONT><FONTcolor="#0000BB">$data3y</FONT><FONT color="#007700">);<BR></FONT><FONT color="#0000BB">$b3plot</FONT><FONT color="#007700">-></FONT><FONTcolor="#0000BB">SetFillColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">"green"</FONT><FONT color="#007700">);<BR></FONT><FONT color="#0000BB">$b4plot </FONT><FONT color="#007700">= new </FONT><FONT color="#0000BB">BarPlot</FONT><FONT color="#007700">(</FONT><FONTcolor="#0000BB">$data4y</FONT><FONT color="#007700">);<BR></FONT><FONT color="#0000BB">$b4plot</FONT><FONT color="#007700">-></FONT><FONTcolor="#0000BB">SetFillColor</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">"brown"</FONT><FONT color="#007700">);<BR><BR></FONT><FONT color="#FF8000">// Create the accumulated bar plots<BR></FONT><FONT color="#0000BB">$ab1plot </FONT><FONT color="#007700">= new </FONT><FONT color="#0000BB">AccBarPlot</FONT><FONT color="#007700">(array(</FONT><FONT color="#0000BB">$b1plot</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">$b2plot</FONT><FONT color="#007700">));<BR></FONT><FONT color="#0000BB">$ab2plot </FONT><FONT color="#007700">= new </FONT><FONT color="#0000BB">AccBarPlot</FONT><FONT color="#007700">(array(</FONT><FONT color="#0000BB">$b3plot</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">$b4plot</FONT><FONT color="#007700">));<BR><BR></FONT><FONT color="#FF8000">// Create the grouped bar plot<BR></FONT><FONT color="#0000BB">$gbplot </FONT><FONT color="#007700">= new </FONT><FONT color="#0000BB">GroupBarPlot</FONT><FONT color="#007700">(array(</FONT><FONT color="#0000BB">$ab1plot</FONT><FONT color="#007700">,</FONT><FONT color="#0000BB">$ab2plot</FONT><FONT color="#007700">));<BR><BR></FONT><FONT color="#FF8000">// ...and add it to the graph<BR></FONT><FONT color="#0000BB">$graph</FONT><FONT color="#007700">-></FONT><FONTcolor="#0000BB">Add</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">$gbplot</FONT><FONT color="#007700">);</FONT><FONT color="#0000BB"></FONT></FONT></CODE></DIV></P><P> Putting this together in an example would then produce the graph asshown below<DIV class="example"><BR> <A href="exframes/frame_example24.html" target="blank"><IMG border="0"HEIGHT="200" src="img/example24.png" WIDTH="310"></A><BR><B>Figure 39:</B> Combining grouped and accumulated bar plots <A href="exframes/frame_example24.html"target="blank">[src]</A> <P></P></DIV></P><P></P><HR NOSHADE><A HREF="toc.html">Contents</A><A HREF="826Usingaccumulatedbarplots.html">Previous</A><A HREF="828Horizontalbargraphs.html">Next</A></BODY></HTML>