Data label on bar charts
Hello,
I have a bar chart where the data labels are centered? Is there a way to make all the data labels aligned at a specific location on all bars regardless of the number?
I know this contradicts of how statistical data is read, but it is a requirement that I have.
Thank youAbdallah El-Chal, PMP, ITIL, MCTS
October 21st, 2010 9:01pm
Hi,
By generally, Reporting Services allow us to specify the position of the data labels. For the detailed steps about
How to Position Labels in a Chart, you can refer to:
http://msdn.microsoft.com/en-us/library/ms156263(v=SQL.100).aspx
However, if the built-in feature cannot meet your needs, please post an example to elaborate the requirements and which version of Reporting Services you are using. Then I will provide
you further assistance.
Thanks,
Tony ChainPlease remember to mark the replies as answers if they help and unmark them if they provide no help
Free Windows Admin Tool Kit Click here and download it now
October 25th, 2010 9:29am
Tony,
Thank you for responding, and sorry I didn't get back to you earlier. The original requirement was to have the labels set at a specific location regardless of the data. For example, if you have two bars, one with value 90, and one with value 60, they want
these values(the bar labels) aligned. So, If we place the values in the center, they don't want the values centerd for each bar. But they want one value to show up at 45(for the 90) for example, and the other value to show up at 45 as well and not at
30. I knew I needed an expression for that, but I wasn't sure how to approach it.
Anyways, the requirement has changed, but if you can provide some feedback about that expression that would be helpful in case they change their minds.
Thank youAbdallah El-Chal, PMP, ITIL, MCTS
November 3rd, 2010 11:26am
Hi Abdallah,
Thank you for your further explanation of the requirement. By generally, we can specify the position of data labels of a Bar Chart by the setting the
BarLabelStyle property in the CustomAttributes category of a series. However, as you noticed, the position is based on the actual value of each bar. In order to display all data labels aligned the center of the bar with max
value like the following picture shows, we need use an additional series.
If it is what you need, please refer to the steps below to achieve this:
1.
Bind the existing data fields to the corresponding chart data. For example, in my report, I add the OrderQuantity field to the Chart data values and add Category field to the category groups
of the chart.
2.
Add a new series to the data value field in the chart with an expression.
If you are using Reporting Services (SSRS) 2008 R2, you can click the + sign of the ∑Values pane and select
Expression.
In SSRS 2008, please add the data field again, then right click the second one and select
Series Properties… In the Series Properties dialog, click the
fx button after the Value field dropdown list.
3.
Specify the expression like:
=Max(Sum(Fields!OrderQuantity.Value),"Chart1")/2
This expression will calculate the half of the max bar value. Please be aware to correct the scope name argument in the Max function to the chart name in your report.
4.
Please right click the new series in the chart and select Show Data Labels.
5.
Right click the Label and select Series Label Properties… In the Label data dropdown list, correct
the expression to the data field of original series, for example, in my report is
=Sum(Fields!OrderQuantity.Value)
6.
In order to hide the addition series, please specify its Color property of the series to No Color.
Thanks,
Tony Chain
Please remember to mark the replies as answers if they help and unmark them if they provide no help
Free Windows Admin Tool Kit Click here and download it now
November 3rd, 2010 11:36pm