Pie Chart

This section provides more information on pie chart attributes and XML.

Tip:

The Reporting and Analytics report builder cannot show negative values in a pie chart. Use the advanced editor to convert negative values to positive values to show the values in the pie chart. Convert negative values by adding * -1 to the column name. The following example shows how to convert a negative discount amount to a positive amount:

Before: sum_discAmt

After: sum_discAmt * -1

Attribute Name XML declaration Description / Notes

name

<cell type="text" data-format="text" alignment="left" style="col_header_1" print-width="130" chart-attr-name="seriesName">TotalOperatingCosts</cell>

“seriesName” is a constant attribute name. The value is derived based on the cell type definition.

items

<cell type="expr" data-format="integer" alignment="right" style="header_1" suppress-formatting="true">DBGET("DailyOpsQuery","prepCostTotal")</cell>

This attribute must directly follow the “seriesName” declaration. This is the chart data points/items values. The “suppress-formatting” property must be set to true. The value is derived based on the cell type definition.

hoverSeriesLabel

<cell type="text" data-format="text" alignment="left" chart-attr-name="hoverSeriesLabel">Test Series</cell>

“hoverSeriesLabel” is a constant attribute name. The value is derived based on the cell type definition.

hoverValueLabel

<cell type="text" data-format="text" alignment="left" chart-attr-name="hoverValueLabel">Test Value</cell>

“hoverValueLabel” is a constant attribute name. The value is derived based on the cell type definition.

extraItem

<cell type="column" data-format="integer" alignment="left" print-width="140" chart-attr-name="extraItem" >salesTotal</cell>

These are extra chart data points/items values. The value is derived based on the cell type definition.

hoverExtraItemLabel

<cell type="text" data-format="text" alignment="left" chart-attr-name="hoverExtraItemLabel">Test ExtraItem</cell>

“hoverExtraItemLabel” is a constant attribute name. The value is derived based on the cell type definition.

dataTypeExtraItemFormat

<cell type="chart_text" data-format="text" alignment="left" chart-attr-name="dataTypeExtraItemFormat">percent</cell>

“dataTypeExtraItemFormat” is a constant attribute name. This applies data formatting to “extraItem” values. The cell type must be set to “chart_text”. The valid value is the same as those that can be defined in cell data-format.

Example of XML Report Definition to Generate Pie Chart JSON Data

<report>

    	<frame type="table" query-name="MajorGroupsQuery" name="barFrame">
               <bands>

                <band type="table-body">
                    <cell type="column" data-format="text" alignment="left" print-width="140" chart-attr-name="seriesName">majorGroupNameMaster</cell> 
                    <cell type="column" data-format="currency" alignment="right" suppress-formatting="true" print-width="70">salesTotal</cell>
					
		<cell type="column" data-format="integer" alignment="left" print-width="140" chart-attr-name="extraItem">salesTotal</cell>
					
		<!-- extra cell to match count in table-column -->
		<cell type="chart_text" data-format="text" alignment="left"></cell> 
	    </band>
				
                <band type="table-column-header">
		<!-- hover series label attribute  -->
                    <cell type="text" data-format="text" alignment="left" chart-attr-name="hoverSeriesLabel">Test Series</cell>
					
                    <!-- hover value label attribute  -->
                    <cell type="text" data-format="text" alignment="left" chart-attr-name="hoverValueLabel">Test Value</cell>
					
		<!-- hover extraItem label attribute  -->
		<cell type="text" data-format="text" alignment="left" chart-attr-name="hoverExtraItemLabel">Test ExtraItem</cell>
					
		<!-- dataTypeExtraItemFormat attribute  -->
		<cell type="chart_text" data-format="text" alignment="left" chart-attr-name="dataTypeExtraItemFormat">percent</cell>
	   </band>
        
           </bands>
        </frame>
    	
    	<layout type="columner">
            <component frame-name="barFrame" column="1" visual-type="ojPie" visual-style="oj-sm-12" visual-title="TotalOperatingCosts"/>
        </layout>

 </report>