Somehow I have managed not to write about the Pie Chart in Microsoft Dynamics CRM. What you can do with the pie chart is fairly limited since only one series is supported.
However, there are a number of custom properties we can use to tweak the appearance of the pie chart.
Custom properties can be found at the end of the series properties. Note that unlike standard properties, custom properties are all added within the quotations of the CustomProperties.
The custom properties we can use on a pie chart in Dynamics CRM are:
I’ll go through each of these properties and add some notes along the way. There’s an XML sample of a series at the bottom of the post with all the custom properties added.
- Default (Default)
Changes the appearance of the pie chart. Yes, the default value is called Default.
For simply changing the appearance, another option is to change the Area3DStyle to true. Although this is not a custom property.
The PieStartAngle is a value between 0 and 360 degrees depending on where you want the first value to start. Microsoft Dynamics CRM pie charts by default start in the 3 o’clock position. That means the 3 o’clock position is 0 degrees and any changes have to take that into account.
- Inside (Default)
PieLabelStyle moves the label inside, outside or disables them completely.
The following four custom properties only apply to pie charts where the PieLabelStyle is set to outside.
Specifies the size of the horizontal segment of the callout line, as a percentage of the chart area.
Value range 0-100. Default is 1. Set to 0 to hide it.
Specifies the size of the radial segment of the callout line, as a percentage of the chart area.
Value range 0-100. Default is 1. Set to 0 to hide it.
Any named color, RGB, ARGB or HEX value can be used. See more about colors in MS Dynamics CRM charts here. Default is Black.
Specifies the minimum pie size. Value range 10 – 70. Default is 30. This property has no effect unless the outside label style is used.
Labels and Keywords
When creating a pie chart, the IsValueShownAsLabel=”True” is already added to the chart XML by default. This is what shows the values inside the chart. These values can be formatted by adding the LabelFormat property to the series. Go here for formatting of values in CRM charts.
If you want to customize the content of the label, IsValueShownAsLabel must be set to “False”.
The two properties on a standard pie charts that can hold custom text and keywords are Label and LegendToolTip. Both of these properties must be added in the series. This is included in the sample XML series at the bottom of post.
Here are the keywords that can be used in pie charts. They should be rather self-explanatory. While the last three work, they are not very useful on a pie chart.
Here’s a sample of what the Label and LegendToolTip could look like with keywords added. You can combine both text and keywords as needed.
And here is how the pie chart looks with the Label.
And with the LegendToolTip.
The LegendToolTip only appears when the mouse hovers over the legend item. Unless changed, the tool tip will show the percentage by default. It’s redundant to show the legend text here, but the option is there.
Label, LegendText, and keywords can be used in the series of other chart types too.
A lot of the pie chart’s custom properties are associated with the CollectedThreshold. The feature combines smaller values into one larger pie slice. This can be useful especially when you have a lot of smaller values that you can’t tell apart anyway.
When using the CollectedThreshold, you must set IsValueShownAsLabel to False. Otherwise an incorrect value will be shown for the collected slice. Only the value of the first collected item will then be shown.
Any value lower than the CollectedThreshold will be be in the collected slice.
If set to true, CollectedThreshold must be between 0-100 and is then defined as a percentage.
Can be any named color, RGB, ARGB or HEX value. More on colors in CRM charts here.
If true, then the collected slice is exploded.
Your label for the collected slice. Supports keywords.
The text in the legend. Supports keywords. Customized legend text is only supported for the collected item.
Text in the tool tip for the collected slice. Supports keywords.
Notes on collected
Keyword #MIN is now the collected value, so it cannot be used to show what the minimum value inside the CollectedThreshold is.
Add keyword #TOTAL only to the CollectedLegendText and the total value will appear only once on the chart.
Include a description of how the CollectedThreshold is defined in the either the CollectedLabel or the CollectedLegendText. That way, the user can better decode the information..
Stuff we unfortunately cannot do with Pie Charts in Dynamics CRM
- LegendText – can’t be changed. Except for collected
- ToolTip – have no effect
- LabelToolTip – have no effect
- Exploded – custom property, have no effect.
- Keyword values cannot be formatted
Yes, you cannot add formatting to keywords, even though the documentation says you can. You’ll get a chart rendering error in Microsoft Dynamics CRM if you try to add it. This makes keywords pretty useless when dealing with large numbers. I have reported the issue to Microsoft, so if you have a minute, please go vote for the case here, and hopefully we can soon unlock even more chart features.
Note that with IsValueShownAsLabel=”True” label formatting in Dynamics CRM charts can still be used.
The documentation for all the pie chart properties can be found here. http://msdn.microsoft.com/en-us/library/dd456674(v=vs.110).aspx
Sample XML of a Pie Chart series with all custom properties.
The sample series can be used to replace the standard series generated by the chart editor.
Thanks for reading. If you have a tip or trick for pie charts that I haven’t found, please include them in the comments. And of course, please sign up for the newsletter to be up to date on new blog posts and follow me on Twitter Follow @crmchartguy