Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Reverse or Mirrored Bar Chart in SSRS

There are some pretty charts out there and most of them can be done in Reporting Services. There is one type of chart I had someone ask for that is not natively built in to SSRS. But with a little manipulation you can get the look you want. Here is an example of the chart I am talking about.

clip_image002

This is a mirror chart showing the genders spread across age groups. The female chart is a basic chart with no extra work done to it.

Here is a sample of the data on the table I am querying. This is just a table I manually filled.

clip_image003

Here is the query and results I used for the Female dataset.

clip_image004

In the female dataset I am grouping by age range and getting a count of the gender column.

In the chart I set up the Gender as the value and the age range as the category.

clip_image005

The Male chart is does not turn out mirrored unless you do some trickery. Here are the steps you can take to get it mirrored.

First, add another column to the query, as you can see in the below image.

clip_image006

This “Diff” column gives you a number that is the difference between the gender count and the number 10. In your data you might need to use a bigger number.

Next you create a stacked bar chart.

clip_image007

In this chart you set the values to be diff and gender in that order. You set the category to age range.

clip_image008

Now for the trickery part, Right click on the Diff series and select series properties.

clip_image009

Click on the fill option on the left and set the color to no color.

clip_image010

The last step is to set the horizontal axis properties. Right click on the horizontal axis and select the properties.

clip_image011

Set the maximum to 10. In your data you might need a bigger number.

clip_image012

Then remove the vertical axis from the male chart if you desire. It should look like the image below.

clip_image013

You might need to manipulate your charts a little more to get them to look just right.


Comments

Leave a comment on the original post [mikedavissql.com, opens in a new window]

Loading comments...