CRM 2011 Charts – Know the Real Potential ~ Part Deux


clip_image002Hello readers, this post is in continuation of my ”Getting to Know Charts” blog series, where we discuss useful features of charts. In the introductory post of this series we learned how to create a 3D chart and a multi series chart. Let’s answer some questions that I raised in the previous post.

1. Using large differences in data ranges can make the chart looks ugly – do charts support a scale break?

Absolutely!! Let’s say you have a chart with a huge gap between the low and high data values .You would prefer showing the two distinct ranges on the chart. The chart looks like the one to the right.

To add scale break export the chart xml and add ScaleBreakStyle under AxisY node:

<AxisY LabelAutoFitMinFontSize="8" TitleForeColor="59, 59, 59" TitleFont="{0}, 10.5px" LineColor="165, 172, 181" IntervalAutoMode="VariableCount"> <MajorGrid LineColor="239, 242, 246" /> <MajorTickMark LineColor="165, 172, 181" /> <LabelStyle Font="{0}, 10.5px" ForeColor="59, 59, 59" /> <ScaleBreakStyle Enabled="True" BreakLineStyle="Straight" Spacing="2" /> </AxisY>

Import the modified xml and your chart now appears as:

clip_image004

Simple! Isn’t it?

Please note that there are few conditions where scale break is not supported. You can find the details documented here.

2. I want to customize the series name and legends to something more meaningful than Sum (Estimated Revenue)

clip_image006The chart in Crm 2011 are based upon the attributes of the entity and hence they reflect the attribute’s name and aggregation (Sum, Avg) if any, in the series names. For e.g. Sum (Actual Revenue) or Count (Name) etc.

However you can customize the series names using the Option Sets (Pick list, Status, State attribute types) in CRM. Take the following example.

Series name “Won” in this Chart is actually derived from the “Opportunity Status”

To modify the series name add the Name attribute to the Series node in the exported xml of the chart. For e.g.:

This will display the Series name as Won:

<Series Name="o:opportunity_statecode,1" Color="149, 189, 66" IsValueShownAsLabel="False" BackGradientStyle='TopBottom" BackSecondaryColor="112, 142, 50" Font="{0}, 9.5px" LabelForeColor="59, 59, 59">

This will display the Series name as Lost:

<Series Name="o:opportunity_statecode,2" Color="255,124,31" IsValueShownAsLabel="False" BackGradientStyle='TopBottom" BackSecondaryColor="235,98,0" Font="{0}, 9.5px" LabelForeColor="59, 59, 59">

You can instruct the chart to pick the series name from the display names of some option set values using the following format:

Name = “o:optionsetLogicalName,optionSetValue

You can use the existing option sets or create your own to reflect the series names. I hope you find this blog post helpful and informative. I have some more charting tips and tricks to share with you soon.

Cheers,

Sonal Sawhney

Comments (6)

  1. Jacob Cynamon-Murphy says:

    Will option #2 allow a user to manually override the order in which the optionset values are displayed or does it just apply the names to the columns, while the column order remains fixed?

  2. JS says:

    Thank you for the great post. Is it possible to change the sort order of the columns in the graph?

  3. Sonal says:

    Jacob,

    In Option #2 you can add an "order" clause on the x or y attribute in the fetchxml part of the chart xml.That will allow overriding the order. Refer the part 1 of this series to understand about the chart xml changes.

    Thanks,

    Sonal

  4. Sonal says:

    JS, as I mentioned above you can use "order" clause in fetch xml to override the sorting.More details here:

    msdn.microsoft.com/…/ee704599.aspx

    Thanks,

    Sonal

  5. Gareth Tucker says:

    Hi,

    Can you explain how we can find out the various Chart properties available to us – e.g. the "ScaleBreakStyle" property.   e.g. I want to change the format of the numbers on my verical axis so as to not show decimal places.   I expect there is a property I can set by cannot find a reference anywhere that provides these list of properties.

    How did you know that the "ScaleBreakStyle" property existed?

    Thanks,

    Gareth.

  6. pmdci says:

    What I'd love to see is other sort of ASP.NET charts in Dynamics CRM, such as radar, area and so on 🙂

Skip to main content