Pie Chart

Top Previous Topic Next Topic  Print this topic

Output:

 

2D version:

chart_pie

3D version:

 

chart_pie_3d

 

The code used to generate this chart is listed below. Adding the highlighted attributes changes the aspect of the chart from 2D to 3D.

 

Code sample:

 

 

<xc:root width="450pt" height="200pt" xmlns:xc="http://www.ecrion.com/2008/xc">

       <xc:defs>

               <xc:linear-gradient id="Red" x1="0%" x2="100%" y1="0%" y2="0%">

                       <xc:stop offset="0.05" stop-color="red"/>

                       <xc:stop offset="0.95" stop-color="orange"/>

               </xc:linear-gradient>

               <xc:linear-gradient id="Navy" x1="0%" x2="100%" y1="0%" y2="0%">

                       <xc:stop offset="0.05" stop-color="navy"/>

                       <xc:stop offset="0.95" stop-color="blue"/>

               </xc:linear-gradient>

               <xc:linear-gradient id="Orange" x1="0%" x2="100%" y1="0%" y2="0%">

                       <xc:stop offset="0.05" stop-color="orange"/>

                       <xc:stop offset="0.95" stop-color="yellow"/>

               </xc:linear-gradient>

               <xc:linear-gradient id="Silver" x1="0%" x2="100%" y1="0%" y2="0%">

                       <xc:stop offset="0.05" stop-color="silver"/>

                       <xc:stop offset="0.95" stop-color="lightgray"/>

               </xc:linear-gradient>

               <xc:linear-gradient id="Violet" x1="0%" x2="100%" y1="0%" y2="0%">

                       <xc:stop offset="0.05" stop-color="violet"/>

                       <xc:stop offset="0.95" stop-color="magenta"/>

               </xc:linear-gradient>

               <xc:linear-gradient id="Gray" x1="0%" x2="100%" y1="0%" y2="0%">

                       <xc:stop offset="0.05" stop-color="darkgray"/>

                       <xc:stop offset="0.95" stop-color="gray"/>

               </xc:linear-gradient>

               <xc:linear-gradient id="Green" x1="0%" x2="100%" y1="0%" y2="0%">

                       <xc:stop offset="0.05" stop-color="green"/>

                       <xc:stop offset="0.95" stop-color="lime"/>

               </xc:linear-gradient>

               <xc:linear-gradient id="Cyan" x1="0%" x2="100%" y1="0%" y2="0%">

                       <xc:stop offset="0.05" stop-color="aqua"/>

                       <xc:stop offset="0.95" stop-color="cyan"/>

               </xc:linear-gradient>

       </xc:defs>

       <xc:pie x="40pt" y="50pt" width="150pt" height="100pt" start-angle="270" slice-orientation="clockwise" aspect-3d-view="true" aspect-3d-chart-depth="15pt">

               <xc:slice font-family="Helvetica" font-size="8pt" fill="url(#Red)" value="13.48" caption="13.48%" caption-offset="10pt"/>

               <xc:slice font-family="Helvetica" font-size="8pt" fill="url(#Navy)" value="8.98" caption="8.98%" caption-offset="20pt"/>

               <xc:slice font-family="Helvetica" font-size="8pt" fill="url(#Orange)" value="7.52" caption="7.52%" caption-offset="20pt"/>

               <xc:slice font-family="Helvetica" font-size="8pt" fill="url(#Silver)" value="3.18" caption="3.18%" caption-offset="25pt"/>

               <xc:slice font-family="Helvetica" font-size="8pt" fill="url(#Violet)" value="16.59" caption="16.59%" caption-offset="35pt"/>

               <xc:slice font-family="Helvetica" font-size="8pt" fill="url(#Gray)" value="16.94" caption="16.94%" caption-offset="35pt"/>

               <xc:slice font-family="Helvetica" font-size="8pt" fill="url(#Green)" value="23.90" caption="23.90%" caption-offset="20pt"/>

               <xc:slice font-family="Helvetica" font-size="8pt" fill="url(#Cyan)" value="9.68" caption="9.68%" caption-offset="10pt"/>

       </xc:pie>

       <xc:legend x="300pt" y="40pt" width="200pt" height="500pt">

               <xc:legend-item label="square" label-width = "10pt" label-spacing="5pt" font-family="Helvetica" font-size="8pt" fill="url(#Red)" stroke="#27558C" caption="Cash Equivalents"/>

               <xc:legend-item label="square" label-width = "10pt" label-spacing="5pt" font-family="Helvetica" font-size="8pt" fill="url(#Navy)" stroke="#27558C" caption="Intermediate-Term Tax Exempt Bonds"/>

               <xc:legend-item label="square" label-width = "10pt" label-spacing="5pt" font-family="Helvetica" font-size="8pt" fill="url(#Orange)" stroke="#27558C" caption="Mid-Cap Stocks"/>

               <xc:legend-item label="square" label-width = "10pt" label-spacing="5pt" font-family="Helvetica" font-size="8pt" fill="url(#Silver)" stroke="#27558C" caption="Small-Cap Stocks"/>

               <xc:legend-item label="square" label-width = "10pt" label-spacing="5pt" font-family="Helvetica" font-size="8pt" fill="url(#Violet)" stroke="#27558C" caption="Large-Cap Growth Stocks"/>

               <xc:legend-item label="square" label-width = "10pt" label-spacing="5pt" font-family="Helvetica" font-size="8pt" fill="url(#Gray)" stroke="#27558C" caption="Intermediate-Term Taxable Bonds"/>

               <xc:legend-item label="square" label-width = "10pt" label-spacing="5pt" font-family="Helvetica" font-size="8pt" fill="url(#Green)" stroke="#27558C" caption="Long-Term Tax Exempt Bonds"/>

               <xc:legend-item label="square" label-width = "10pt" label-spacing="5pt" font-family="Helvetica" font-size="8pt" fill="url(#Cyan)" stroke="#27558C" caption="Other"/>

  </xc:legend>

</xc:root>