## Changing a Pie Chart Display

Just a quick one. I had a requirement to change a Pie Chart from showing the sum of money to showing % split and money. To do this, you have to edit the XML of the chart. I find the best way to get a chart just so is to create it first as a personal chart, then export and import it into the solution (a special option just for charts). You can also use this same feature to edit the XML.

### Editing the XML

You will need to download the chart and edit the XML e.g. Notepad

**Step 1** - Turn off default label.

```xml
IsValueShownAsLabel="False"
```

**Step 2** - Add

```xml
Label="#PERCENT - GBP [#VAL](/content/blog/hashtags/VAL/index.html)"
```

The reason for GBP vs. £ symbol is a bug in Dynamics (8.2) where the £ sign doesn’t display; it seems unable to find the unicode character (I was testing in Chrome).

```xml
<Series>
    <Series ShadowOffset="0" IsValueShownAsLabel="False" Label="#PERCENT - GBP [#VAL](/content/blog/hashtags/VAL/index.html)" Font="{0}, 9.5px" LabelForeColor="59, 59, 59" CustomProperties="PieLabelStyle=Inside, PieDrawingStyle=Default" ChartType="pie">
        <SmartLabelStyle Enabled="True" />
    </Series>
</Series>
```

### Full XML extract below.

### Full XML File after Edit

```xml
<visualization>
    <visualizationid>{DCBBA491-9E7E-E811-8119-0050563013E7}</visualizationid>
    <name>Win Value</name>
    <primaryentitytypecode>opportunity</primaryentitytypecode>
    <datadescription>
        <datadefinition>
            <fetchcollection>
                <fetch mapping="logical" aggregate="true">
                    <entity name="opportunity">
                        <attribute name="bae_opportunitystatusid" groupby="true" alias="_CRMAutoGen_groupby_column_Num_0" />
                        <attribute name="bae_totalestimatevalue" aggregate="sum" alias="_CRMAutoGen_aggregate_column_Num_0" />
                    </entity>
                </fetch>
            </fetchcollection>
            <categorycollection>
                <category alias="_CRMAutoGen_groupby_column_Num_0">
                    <measurecollection>
                        <measure alias="_CRMAutoGen_aggregate_column_Num_0" />
                    </measurecollection>
                </category>
            </categorycollection>
        </datadefinition>
    </datadescription>
    <presentationdescription>
        <Chart Palette="None" PaletteCustomColors="91,151,213; 237,125,49; 160,116,166; 255,192,0; 68,114,196; 112,173,71; 37,94,145; 158,72,14; 117,55,125; 153,115,0; 38,68,120; 67,104,43; 124,175,221; 241,151,90; 186,144,192; 255,205,51; 105,142,208; 140,193,104; 50,125,194; 210,96,18; 150,83,159; 204,154,0; 51,90,161; 90,138,57;">
            <Series>
                <Series ShadowOffset="0" IsValueShownAsLabel="False" Label="#PERCENT - GBP [#VAL](/content/blog/hashtags/VAL/index.html)" Font="{0}, 9.5px" LabelForeColor="59, 59, 59" CustomProperties="PieLabelStyle=Inside, PieDrawingStyle=Default" ChartType="pie">
                    <SmartLabelStyle Enabled="True" />
                </Series>
            </Series>
            <ChartAreas>
                <ChartArea>
                    <Area3DStyle Enable3D="false" />
                </ChartArea>
            </ChartAreas>
            <Legends>
                <Legend Alignment="Center" LegendStyle="Table" Docking="right" IsEquallySpacedItems="True" Font="{0}, 11px" ShadowColor="0, 0, 0, 0" ForeColor="59, 59, 59" />
            </Legends>
            <Titles>
                <Title Alignment="TopLeft" DockingOffset="-3" Font="{0}, 13px" ForeColor="0, 0, 0" />
            </Titles>
        </Chart>
    </presentationdescription>
    <isdefault>false</isdefault>
</visualization>
```

### Tags

[#Dynamics365](/content/blog/hashtags/Dynamics365/index.html) [#Charts](/content/blog/hashtags/Charts/index.html) [#Reports](/content/blog/hashtags/Reports/index.html) [#Dashboards](/content/blog/hashtags/Dashboards/index.html)
