3.5 Doughnut Chart Example

Applies to RDL schemas 2003/10 [MSFT-RDL200310] and 2005/01 [MSFT-RDL200501] only

The following sample report shows a doughnut chart.

Doughnut chart example

Figure 14: Doughnut chart example

The following table shows the data that this chart is bound to.

Product category name

Year

Quantity

Accessories

2001

1003

2002

27207

2003

23734

2003

103978

2004

292660

Bikes

2001

14256

2002

49810

2003

30773

2003

43241

2004

42456

Clothing

2001

2132

2002

16927

2003

16515

2003

18862

2004

19234

Components

2001

75892

2002

332885

2003

266860

2003

314930

2004

661065

This chart shows the sum of the quantity for each product category regardless of the year. The following RDL snippet shows how the chart is specified to display data the way it looks in the preceding picture.          

 <Chart Name="chart1">
   <DataSetName>SalesPerProduct</DataSetName>
   <PointWidth>0</PointWidth>
   <Palette>Pastel</Palette>
   <Subtype>Plain</Subtype>
   <Type>Doughnut</Type>
   <Top>0.125in</Top>
   <Left>0.125in</Left>
   <Width>6.25in</Width>
   <Height>3.125in</Height>
   <CategoryAxis />
   <ValueAxis />

This is a doughnut chart bound to a DataSet that is called "SalesPerProduct" with a Pastel palette.          

   <SeriesGroupings>
     <SeriesGrouping>
       <DynamicSeries>
         <Grouping Name="chart1_SeriesGroup1">
           <GroupExpressions>
               GroupExpression>=Fields!ProductCategoryName.Value</GroupExpression>
           </GroupExpressions>
         </Grouping>
         <Label>=Fields!ProductCategoryName.Value</Label>
       </DynamicSeries>
     </SeriesGrouping>
   </SeriesGroupings>

The series grouping specifies that each Product Category value is in the legend. Note that the Label element specifies the text of the item in the legend. The number of the series groups is the number of slices in the chart. The sizes of the slices are determined by the following value.          

   <ChartData>
     <ChartSeries>
       <DataPoints>
         <DataPoint>
           <DataValues>
             <DataValue>
               <Value>=Sum(Fields!Quantity.Value)</Value>
             </DataValue>
           </DataValues>
           <DataLabel>
             <Style />
             <Value>=Fields!Quantity.Value</Value>
             <Position>BottomRight</Position>
             <Visible>true</Visible>
           </DataLabel>
         </DataPoint>
       </DataPoints>
     </ChartSeries>
   </ChartData>

As shown in the figure, each slice has its value displayed as a DataLabel element as specified in the above RDL.          

   <Legend>
     <Visible>true</Visible>
     <Style>
       <BorderStyle>
         <Default>Solid</Default>
       </BorderStyle>
     </Style>
     <InsidePlotArea>true</InsidePlotArea>
   </Legend>

The Legend element is displayed inside the PlotArea element with the gradient background color specified by the PlotArea element in the following RDL.          

   <PlotArea>
     <Style>
       <BackgroundColor>LightGrey</BackgroundColor>
       <BackgroundGradientType>TopBottom</BackgroundGradientType>
       <BorderStyle>
         <Default>Solid</Default>
       </BorderStyle>
     </Style>
   </PlotArea>
  

Because this is a 3D chart, the ThreeDProperties element must be specified as well in the following RDL.          

   <ThreeDProperties>
     <Enabled>true</Enabled>
     <Rotation>30</Rotation>
     <Inclination>30</Inclination>
     <Shading>Real</Shading>
     <WallThickness>50</WallThickness>
   </ThreeDProperties>
  

The following RDL specifies the chart title text and the chart style.          

   <Style>
     <BackgroundColor>White</BackgroundColor>
   </Style>
   <Title>
     <Caption>Sales per Product Category</Caption>
   </Title>
 </Chart>
Show: