Legend...wait for it...nope, that's all - legend.

Posted by on June 22, 2012  |  commentsComments (1)

Today's guest blogger is Jacob Cynamon-Murphy, a Technical Specialist at Sonoma Partners

Barney Stinson is not the only person who cares about things being legendary.  I was building out a demo of Microsoft Dynamics CRM 2011 (CRM) and I created what I considered a pretty cool chart.  Much to my chagrin, the legend was showing in the reverse order (see Before image, below).

Before

I scoured the internet for guidance, but found that there was no documentation going this deep into customizing the legend of a chart in CRM.  Ultimately, my past developer experience helped me dig up the way to do this (see After image, below).  By adding one attribute to the Legend element, I was able to reverse the order.

Code
After

Technical explanation: Behind the scenes, CRM is mapping a declarative model (XML) to an imperative model (.NET).  The XML appears to reflect the structure of the Chart class in the System.Web.UI.DataVisualization namespace.  As a result, we can discover additional elements and attributes that we can use in the chart XML to control the presentation of the chart elements.  Empowered with this knowledge, I now know exactly where to go for more control over my CRM charts.  For example, with the Legend change I made, I found the Legend class had a property called LegendItemOrder, with three options: Auto, SameAsSeriesOrder and ReversedSeriesOrder.  Knowing that I wanted to reverse the order that CRM was using, I defined LegendItemOrder as an attribute with a value of "ReversedSeriesOrder".  Legend… wait for it… dary!

 

Comments

  1. Any ideas on how to flip the data around, so the red on the chart is on the top and cyan on the bottom?

    Posted by: Alex  |  Nov 6, 2012 8:23:23 AM

Post a Comment

  • *Required

Contact Us for a Quote, or Personalized Demonstrationof Microsoft Dynamics CRM for Your Business.

Contact Us