Design options for bar charts and Top X bar charts

Here’s a couple of design options to improve bar charts, fix some pet peeves of mine, or simply change things up a little.

Those pet peeves are truncated labels and always putting the top record on the bottom. Fortunately, both of those can be fixed as seen below.

Top 5 Chart - Top item on on top - Full Labels, non-truncated. CRM Chart, CRM 2011

MS CRM top 5 bar chart with the top item on top and non-truncated labels.

I’ve also positioned the labels on the inside of the chart, which is a better utilization of space.

Top X Charts

If you make a Top 5 Bar Chart, you get this.

Top 5 Bar Chart - Standard, made in CRM Chart editor

Top 5 bar chart made in the CRM Chart editor.

It has always puzzled me that the “top” item is on the bottom.  Nobody want’s to see their name on the bottom of a list. My first idea was to change the order in the xml from descending=”true” to descending=”false”. While that will reverse the order of the Bar chart, it will also only return the bottom 5 records rather than the top 5. Good to know if you ever need to make a bottom x chart of something.

Turns out the xml modification is even easier. Add IsReversed=”True” to your AxisX properties and you now get a Top 5 Bar chart with the top record on top.

crm chart xml axis x isreversed="true", CRM 2011

CRM Top 5 Chart barchart with X axis reversed and top item on top.

The same top 5 chart with the X axis reversed and top item on top.

Truncation of Axis Labels

Label truncation is particularly annoying when users name all their records something like “Campaign for xyz” or “Opportunity for xyz”. All you see on the labels are the “Campaign for…”. Somehow the “…” always contains the most important part.

To fix that, plus a few other modifications, I’m going to:

  • Add the axis label to the bar series, to get the label on the inside of the chart
  • Left align the axis label via Custom Properties
  • Make the bar color semi-transparent so it’s easier to read the labels
  • Increase the text size a little
  • Remove current truncated labels by disabling the X axis
  • Use a StackedBar chart type

xml axis labels inside

Top 5 BarChart CRM 2011 reversed - labels on inside across the bars

There are 4 spaces in front of the #AXISLABEL. That is to control the positioning and ensure the label doesn’t start before the bar does.

Font is increased from 9.5px to 11px.

ARGB colors was used  to add transparency. In this case a little over 50% transparency.

Custom property BarLabelStyle=Left is added to make sure the labels are aligned along the X axis.

StackedBar is used instead of a Bar chart, because that, in conjunction with BarLabelStyle=”Left”, forces all the labels to start along the axis. On a Bar chart the label may move right, till the end of a short bar. Even when it’s left positioned.

On AxisX; IsReversed=”True” to get the top item on top, and Enabled=”false” to remove the original truncated labels.

Hope you liked it. Please sign up for new posts or follow me on Twitter 

Advertisements

, , , , ,

  1. #1 by WhiteySenior on September 19, 2013 - 12:01 am

    The IsReversed=”True” does not import with Orion CRM 2013

    • #2 by CRM Chart Guy on September 27, 2013 - 10:01 am

      I haven’t had any issues with it on CRM 2013.

  2. #3 by Tsei Tsei on November 25, 2013 - 1:02 am

    Can I have three bars on same chart? One for total cases, one for resolved and one for open cases? I can do that with two separe charts but it would be better if all the info are in one chart.

  3. #5 by Kevin on August 22, 2014 - 8:03 am

    Is it possible to have the Label & the value on each bar?
    i.e. I want to still keep the Value as the label but not have the Axis label truncated

    • #6 by Kevin on August 29, 2014 - 4:18 am

      Hey I found the answer to this using the #VAL and changed the label like below;

      Label=” #AXISLABEL #VAL “

      • #7 by CRM Chart Guy on August 29, 2014 - 9:09 am

        Hi Kevin. Thanks for sharing. The only downside of the #VAL is that you cannot apply formatting to it. Not an issue if you are working with low numbers though, but in the thousands and higher it can get difficult to read. Your other option would be to create two identical series and display them on top of each other. That way you can format and position the two labels individually, but you may run into issues with labels overlaying each other in certain situations. What works best depends on the individual situation.

  4. #8 by Ashish on September 4, 2014 - 12:08 am

    Hi. Thank you for your wonderful posts! I have following queries related to CRM Charts.
    1. How to get top X (where X=5, 10 or any number) data/rows in a given chart
    2. I have field as total hours which only shows aggregate for count & count non-empty (its a text field). So how do I convert it to an integer or a number to get the total.

    Thank you

  5. #9 by Ashish on September 4, 2014 - 12:34 am

    Hi. I would like to correct my above query. The total hours field is an option set in CRM. If it would have been decimal or currency, then addition would have been possible. So is there a way to convert to decimal inside XML code.
    Thank you

  1. Bubble Charts in Dynamics CRM | crm chart guy
  2. Charting on Activity Parties in MS Dynamics CRM | 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: