Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSRS display label at base of column chart columns

Tags:

ssrs-2008

I am trying to get the labels of this column chat to appear at the columns base much like in the second image below. However that solution doesn't completely work as it skews the rest of the information.

Does anybody know the appropriate way to accomplish this, it's madding that this isn't straight forward.

enter image description here

like image 584
HelloWorld Avatar asked Oct 11 '13 15:10

HelloWorld


People also ask

How do I add data labels in SSRS?

Create an Area, Column, Line or Scatter chart. On the design surface, right-click the chart and select Show Data Labels. On the design surface, click the series. The properties for the series are displayed in the Properties pane.

How do I get data labels outside an Excel chart?

On the Layout tab, in the Labels group, click Data Labels, and then click the option that you want. For additional data label options, click More Data Label Options, click Label Options if it's not selected, and then select the options that you want.

How do you prevent data labels from overlapping in Excel pie chart?

Stop Labels overlapping chartRight click on the Axis. Choose the Format Axis option. Open the Labels dropdown. For label position change it to 'Low'


1 Answers

I'm using the following data:

enter image description here

Take a standard Chart:

enter image description here

The first Chart Series is our data series, with a Chart Type of standard Column, and the second Chart Series based has a Chart Type of Line, based on a target value to get the required line in the Chart Area.

As you've probably seen, you do have some control over label placement, but not to meet your requirements. The best we can do is use the Bottom position for the label position, which isn't even close:

enter image description here

enter image description here

What can we do? First, remove the labels from the existing Series.

Next, add a new Series to the Chart:

enter image description here

Basically we're using a constant here, which should be the lower bound of the Y axis. I'm using 0 in this case.

This new Chart Series needs to be first in the order of all the Chart Series.

Change the Chart Type for the first two Chart Series to Stacked Column:

enter image description here

Add Series labels to this new Chart Series. Set the Label data expression under the Series Label Properties. The expression I've used is:

=Sum(Fields!val.Value, "CategoryGroup")

Since the two Chart Series share the same Scope, we can leverage this to get the values of the data group as above.

Here, CategoryGroup is the name of the Category Group:

enter image description here

The updated chart looks like:

enter image description here

And the result is labels at the base of each column as required:

enter image description here

Seems like the required result, even if it took a while to get there.

So, by using a dummy Chart Series which is at the base of the Y axis for each group, we can anchor the label at the bottom as required, and by using the label expression to display a different Chart Series value, it looks a label on the actual data group!

Edit after comment

You can definitely use expressions to set the minimum axis value and also the dummy Chart Series, it's just a case of whether you can get the exact one required.

In my example, say we change the axis value to the minimum in the Dataset:

enter image description here

i.e. =Min(Fields!val.Value)

Since the Dummy Chart Series would be looking at the Scope of each individual Category Group, we need a slightly different expression to get the same value:

=Min(Fields!val.Value, "DataSet1")

This changes the chart as we would expect:

enter image description here

You could also add a buffer to the value, something like:

=Min(Fields!val.Value) - 1

So you don't get columns with no height.

For more complex expressions, there may be issues, i.e. in 2008 you cannot get aggregates on aggregates, which might be useful, and even then it's difficult to bring this into the dummy Chart Series.

Sometimes, if possible, it's easiest to add columns to your Dataset with these values pre-generated and use these fields instead of trying to calculate it in the report.

like image 190
Ian Preston Avatar answered Oct 21 '22 18:10

Ian Preston