All things Pie Chart in Dynamics CRM

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.

CustomProperties in Pie Chart XML for Dynamics CRM

The custom properties we can use on a pie chart in Dynamics CRM are:

  • PieDrawingStyle
  • PieStartAngle
  • PieLabelStyle
  • LabelsHorizontalLineSize
  • LabelsRadialLineSize
  • PieLineColor
  • MinimumRelativePieSize
  • CollectedThreshold
  • CollectedThresholdUserPercent
  • CollectedColor
  • CollectedSliceExploded
  • CollectedLabel
  • CollectedLegendText
  • CollectedToolTip

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.

PieDrawingStyle

  • Default (Default)
  • SoftEdge
  • Concave

Changes the appearance of the pie chart. Yes, the default value is called Default.

Dynamics CRM chart. Chart type Pie. PieDrawingStyle Default

PieDrawingStyle=Default

Dynamics CRM chart. Chart type Pie. PieDrawingStyle SoftEdge

PieDrawingStyle=SoftEdge

Dynamics CRM chart. Chart type Pie. PieDrawingStyle Concave

PieDrawingStyle=Concave

For simply changing the appearance, another option is to change the Area3DStyle to true. Although this is not a custom property.

Dynamics CRM chart. Chart type Pie. 3D enabled

3D Enabled

PieStartAngle

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.

Dynamics CRM chart. Chart type Pie. PieStartAngle 270 degrees Custom Property

PieStartAngle=270 start the first slice in the 12 o’clock position

PieLabelStyle

  • Inside (Default)
  • Outside
  • Disabled

PieLabelStyle moves the label inside, outside or disables them completely.

Dynamics CRM chart. Chart type Pie. PieLabelStyle Inside Default

PieLabelStyle=Inside

Dynamics CRM chart. Chart type Pie. PieLabelStyle Outside

PieLabelStyle=Outside

The following four custom properties only apply to pie charts where the PieLabelStyle is set to outside.

LabelsHorizontalLineSize
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.

LabelRadialLineSize
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.

PieLineColor
Any named color, RGB, ARGB or HEX value can be used. See more about colors in MS Dynamics CRM charts here. Default is Black.

MinimumRelativePieSize
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.

  • #LEGENDTEXT
  • #VAL
  • #PERCENT
  • #TOTAL
  • #MIN
  • #MAX
  • #FIRST
  • #LAST
  • #INDEX

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.

Label="#LEGENDTEXT #PERCENT  -  #VAL out of #TOTAL total" 
LegendToolTip="#LEGENDTEXT #PERCENT  -  #VAL out of #TOTAL total"

And here is how the pie chart looks with the Label.

Label with Keywords. Dynamics CRM chart. Chart type Pie.

Label=”#LEGENDTEXT #PERCENT – #VAL out of #TOTAL total”

And with the LegendToolTip.

LegendToolTip with Keywords. Dynamics CRM chart. Chart type Pie.

LegendToolTip=”#LEGENDTEXT #PERCENT – #VAL out of #TOTAL total

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.

CollectedThreshold

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.

CollectedThreshold
Any value lower than the CollectedThreshold will be be in the collected slice.

CollectedThresholdUsePercent
If set to true, CollectedThreshold must be between 0-100 and is then defined as a percentage.

CollectedColor
Can be any named color, RGB, ARGB or HEX value. More on colors in CRM charts here.

CollectedSliceExploded
If true, then the collected slice is exploded.

CollectedLabel
Your label for the collected slice. Supports keywords.

CollectedLegendText
The text in the legend. Supports keywords. Customized legend text is only supported for the collected item.

CollectedToolTip
Text in the tool tip for the collected slice. Supports keywords.

Dynamics CRM chart. Chart type Pie. Collected Options used in custom properties

Using collected properties.

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.

<Series	ChartType="pie" ShadowOffset="0" IsValueShownAsLabel="False" 
	Font="{0}, 9.5px" LabelForeColor="59, 59, 59" 
	Label="#LEGENDTEXT #PERCENT  -  #VAL out of #TOTAL total" 
	LegendToolTip="#PERCENT  -  #VAL out of #TOTAL total"
	CustomProperties="PieDrawingStyle=Concave,
			  PieStartAngle=270,
			  PieLabelStyle=Inside, 
			  PieLineColor=Black,
			  LabelsHorizontalLineSize=1,
			  LabelsRadialLineSize=1,
			  MinimumRelativePieSize=10,
			  CollectedThresholdUsePercent=True,
			  CollectedThreshold=10,
			  CollectedColor=Tan,
			  CollectedSliceExploded=True,
			  CollectedLabel=Collected #VAL - #PERCENT,
			  CollectedLegendText=Collected - #VAL out of #TOTAL total,
			  CollectedToolTip=#VAL out of #TOTAL total">
  <SmartLabelStyle Enabled="True" />
</Series>

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 

Advertisements

, , , , ,

  1. #1 by RH on March 23, 2014 - 7:08 pm

    Hey – another great post! Thanks. FYI, the link to the MS case is broken…

  2. #4 by Doug H on August 13, 2014 - 1:18 pm

    Great Post. Thanks. Question: Does anyone know a way to format the KEYWORDS? i.e. it is displaying the #TOTAL (sum of sales) as a crazy long number that is unformatted. would love to be able to change this to a currency format…

  3. #5 by Maren Ewert on August 14, 2014 - 8:39 am

    Great Post! Really helped me a lot! One question: Any idea how to format the label, so that it does not overwrite other labels? I have some small chunks (which are on purpose are not collected) and the value (shown outside and only percentage) are partially lying on top of each other, so it is impossible to read them. Also the lines indicating to which part of the pie the percentage is belonging are not shown.

    I added the values like this (inside the correct context of course”): CustomProperties=”PieLabelStyle=Outside, LabelsHorizontalLineSize=1, LabelRadialLineSize=1, PieStartAngle=270″
    Would be happy for a hint…

    Thank you!
    KR,
    Maren

  4. #6 by Sanchita on September 2, 2014 - 8:45 am

    Hi,
    Really Great Post!!

    I got a question though, Can we show the total count of all parts? for eg. I have slice1 with count 400, slice 2 with 35 etc, so I want to show the total of all slices as the axis label may be.
    Is it possible somehow?

    • #7 by CRM Chart Guy on September 3, 2014 - 1:01 pm

      Thanks. There are some descriptions on how to use the #TOTAL keyword for this purpose throughout the post.

  5. #8 by Chris Mahanes on December 17, 2014 - 12:01 pm

    I have a question. When working on a bar chart you can insert a format of Format=”0’%’” on the Y axis to remove the decimals. How can this be done on a pie chart?

    • #9 by CRM Chart Guy on December 17, 2014 - 12:22 pm

      Unfortunately that is not possible. The percent label on pie charts are added using keywords like #PERCENT, which MS CRM for no good reason does not support formatting of.

      • #10 by Christopher Mahanes on December 17, 2014 - 1:44 pm

        that is what I was afraid of

  6. #11 by Sharjeel on September 10, 2015 - 2:12 pm

    I’m trying to show the dollar amount Won and Lost on a pie chart but I also would like to show the percentage. So far, the code I write shows me either the dollar amount or it shows me the percentage – it’s never both. How can I accomplish that?

  7. #12 by Eric on October 13, 2015 - 10:42 am

    Is there a way to pull values directly from a page to show in a pie chart on that page? For example, I want to show a budget pie chart whose components consist of fields on that budgetary page, NOT from the subgrid on the page. That way, I can have field values shown that reference the budget overall, and not just each subitem that is related to the budget.

    It should consist of five values that come from the same page – the active entity.

  8. #13 by George on December 17, 2015 - 2:51 am

    Hi,
    thank You for your post, but I still have a one question. Could I create a border between parts in pie chart? I need 2px white line between each line in my chart, but I don´t know if its possible, or how can I do this?

    Thank You,
    your blog helped me a lot with my work in MS Dynamics.

  9. #14 by Raymond Casey (@ray_casey) on February 2, 2016 - 8:01 am

    Awesome stuff and thanks! This may have been asked and sorry if it is repeat, but can you use Pie Charts to show roll up data, e.g. I am a manager and have 3 direct reports. They have opp’s that we code with a risk/issue tag, such has hot, warm and cold. Can the Pie chart show three slices (hot, warm and cold) and then within each slice show who the owner is?

    • #15 by Eric Vasbinder on February 3, 2016 - 7:19 am

      Partially. We are using the pie chart to show the first level. In our case, the amount of budget that is committed, reserve, or discretionary. I do not think it can go one level deeper though – to show the elements within each pie slice that roll up to the higher level slice.

  10. #16 by Payam Zare on August 2, 2016 - 11:01 pm

    The chart explode and Chart percent are not working… I want this feature 😦
    Please Help me

  1. Improved labels on CRM Pie Charts | CRM Perth
  2. Add Percentage Labels to a 100% Stacked Bar chart in MS Dynamics CRM | crm chart guy
  3. Funnel Charts Suck and You Shouldn’t Use Them | crm chart guy

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: