Related sites:

Newsletter: Perspectives on Power Platform

Company: Niiranen Advisory Oy

Turn the flat Dynamics CRM 2011 charts into 3D

We’ve got charts and dashboards!” Yes, ok, so that’s the common initial reaction to one of the most visible new features of Microsoft Dynamics CRM 2011. After playing around with the OOB charts in CRM 2011 Beta and building a few of your own personal charts with the simplified editor that’s available right in the end-user UI, the next reaction is likely to be “I wish I could do more with these charts“.

The good news is: you absolutely can! The bad news? It requires a bit of XML editing. Now don’t go running away all scared, because it doesn’t take a .NET developer to perform some basic tweaks into the CRM 2011 charts. Heck, even I was able to figure it out after an hour of surfing around the documentation and blog posts on Microsoft Chart Controls for .NET 4.

In this quick example I will take the a custom chart I built in the solution customization UI for CRM 2011 and inject some more parameters into it to enhance the presentation. The first thing we’ll need to do is select the chart you want to modify in CRM and click Export Chart to grab the XML definition for the chart.

Open the XML file in the editor of your choice and have a look at the structure. Inside the <presentationdescription> tag you’ll find details about the <Chart> in question. What we’ll want to do in this example is insert more attributes inside the <ChartArea> tags. From MSDN Library we can find the following piece of information:

The Chart control supports 3D charts. To use 3D charts, set the respective chart area’s Area3DStyle.Enable3D property to True.

So, we know we’ll want to have the <Area3DStyle> tag in there with some parameters. In my chart we can apply the following addition into the chart definition XML:

<ChartAreas>
<ChartArea BorderColor=”White” BorderDashStyle=”Solid”>
<AxisY IsLabelAutoFit=”False” TitleForeColor=”59, 59, 59″ TitleFont=”{0}, 10.5px” LineColor=”165, 172, 181″ IsReversed=”False”>
<MajorGrid LineColor=”239, 242, 246″ />
<LabelStyle Font=”{0}, 10.5px” ForeColor=”59, 59, 59″ />
</AxisY>
<AxisX IsLabelAutoFit=”False” TitleForeColor=”59, 59, 59″ TitleFont=”{0}, 10.5px” LineColor=”165, 172, 181″ IsReversed=”False”>
<MajorGrid Enabled=”False” />
<MajorTickMark Enabled=”False” />
<LabelStyle Font=”{0}, 10.5px” ForeColor=”59, 59, 59″ />
</AxisX>
<Area3DStyle Enable3D=”True” LightStyle=”Realistic” WallWidth=”5″ IsRightAngleAxes=”true” />

</ChartArea>

Once we save the XML file and import it into a new CRM chart, the results will be the following:

There you go, that’s all there’s to it. Or more specifically, that’s just the beginning of what the visualizations in Dynamics CRM 2011 are capable of. Have a look at the MSDN Library for Visual Studio 2010 on articles about using Chart Controls or browse the Chart Controls for .NET Framework forum for questions and answers on how to work with the charts available in CRM 2011. Downloading the Sample Environment for Microsoft Chart Controls might also be a good place to start.

20 Comments

  1. This is fantastic but it does make me wonder why MS didn’t allow customisation within CRM. It smacks to me of keeping plenty of jobs for their resellers – surely it can’t be that difficult to add a 3D button within the chart customisation of CRM?

    • When I was listening to Barry Givens discuss the CRM 2011 chart features in Convergence EMEA 2010, he described the process of designing the functionality available in the CRM UI and had quite convincing reasoning behind the end result. For a typical end-user, the number of controls in the charting menus could easily make the feature appear too complex. Sure, people who are working with Dynamics CRM full time would surely welcome more parameters available in the GUI, but I do agree with Barry on his point. If you start adding more formating options, where do you stop? And would the 3D parameter be the most crucial feature to include?

      You could argue that there are plenty of other customization points in CRM 2011 that would also deserve a GUI. For example, editing the ribbon is another exercise in XML manipulation. The way I see it, it’s great that such functionality for UI customization is available in the Dynamics CRM platform right now. If building a graphical editor would have meant the functionality would have needed to be delayed until the next version, I’m glad we have the XML available today already. Now with the more agile release schedule for upcoming CRM releases (twice per year), there’s a real chance that customization features like these will be gradually improved to become easier to use. Furthermore, I don’t see anything stopping a 3rd party from developing a tool to produce the required XML, for example through a SilverLight solution that you could deploy into your CRM organization.

    • Unfortunately I haven’t come across a way to make the Dynamics CRM 2011 charts show percentage values. Looks like the Fetch XML query in the chart definition allows different types of aggregates, but whether displaying percentages is supported or not, that remains to be seen.

  2. I just tried this with CRM online and I cannot get 3D, so appears not to be valid with CRM Online.

    • I tested converting a bar chart into 3D in CRM Online and it did work for me. If you’re copying the parameter from the blog text, be careful that quotation marks don’t get corrupted, since that was the reason why my initial attempt failed.

  3. hi,

    i have one question, can we make it cylinderical, the bar chats…

    if so, what is the component for it…

    thanks,
    yes.sudhanshu

    • You can turn the bar chart into a cylinder by adding the following string into the custom properties of the series in the chart XML: DrawingStyle=Cylinder. Here’s an example:

      Series ChartType=”Bar” IsValueShownAsLabel=”True” Font=”{0}, 9.5px” LabelForeColor=”59, 59, 59″ CustomProperties=”PointWidth=0.75, MaxPixelPointWidth=40, DrawingStyle=Cylinder”

      You can view more chart style modification examples in the following blog post by Microsoft Dynamics CRM Team: http://blogs.msdn.com/b/crm/archive/2012/01/24/crm-2011-chart-enhancements.aspx

  4. Hi,
    Nice post. Have question.
    how do you set the timer for charts to refresh.

    Thanks.
    Gary

    • Gary, the charts are just like regular views in CRM. They don’t refresh automatically if you don’t navigate away from the page or alter the filters of the view which they are representing in a graphical format.

  5. The drill-down chart for the given 3D chart displays Flat chart, is there anyway we can tweak the XML to keep the style (3D appearance) consistence all the way down?

    -P

    • I don’t know exactly what defines the chart being selected for the drill-down selection, I’ve been wondering about it several times myself. If anyone has more insight on the topic, I’d be glad to hear about it.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.