Reporting Services dynamic chart width - reporting-services

I have a bar chart that can display various number of bars depending on user multi-select. How do I get the bar chart to dynamically adjust to the number of bars being displayed? The only solutions I found online were dated 2008 and weren't good solutions either, surely there must be a proper way of doing this?
Thanks

While I was about to rubbish such an idea, as it is known that you cannot dynamically change table sizes and locations, it seems Reporting Services is wonderfully inconsistent.
If you look in the Properties of the chart there is a field called DynamicWidth, which will, as suggested, dynamically change the width of the chart based on a value.
For example I have set a parameter called Offset to default to 10.
You can then set the value of DynamicWidth to
=CStr(Parameters!Offset.Value) + "cm"
Then, as you change the Offset parameter, the width of the chart changes.
DynamicWidth = 10
And
DynamicWidth = 20
Now how you calculate the width to be meaningful and consistent is up to you (perhaps a permanent value for the size + (number of columns * column width)), but this should get you started.
Note that a DynamicWidth of 0 causes the report not to render.

Related

Set static height for bar chart using SSRS

I have a bar chart and the business has requested that I set the height for each bar at a static height i.e. 40 for the entire result set and then have the data labels displayed above the bar.
How can I set the output to a static height for each bar for the entire chart?
It looks like setting the maximum on the Axis plays silly games with the data labels so - as with most things SSRS - lets get creative!
Create your chart as normal.
Open up your Series Properties and change your Series Data Value Field to =iif(<Your column value expression here> > 40, 40, <Your column value expression here>). This will max out your columns at 40.
Open up your Series Label Properties and change the Label Data to =<Your column value expression here>. This will show the true value in your Data Label.
******************************** Alternatively *******************************
you could just enable Scale Breaks on your vertical axis and see if the business likes the look of that as, I would imagine from experience, what they actually want is more visibility on the difference between the smaller columns that are dwarfed by your Oct 10 column and not a pointless column chart where comparison is impossible without manually reading a load of figures.

Large ratio values ssrs chart

I have a bar chart that show the count of number of models for each agency,
The problem is that I have a large difference between the values that makes the report to look not so good.
Does anyone have any ideas of a good way to resolve this problem?
Have you considered using a logarithmic scale?
With your chart Right-click the y-axis, and click Vertical Axis Properties.
In Axis Options, select Use logarithmic scale.
Leave the Log base text box as 10 (this is the scale most commonly used by logarithmic charts)
This will display a chart with a scale that goes up by a factor of 10 for each ‘unit’ up, so the distance between 1 and 10 is the same as that between 100 and 1000.
For example the shown dataset is displayed as this chart when using the logarithmic scale
This method is a simple and recognised way to clearly show values of widely different scales.
Update
If want an indicative bar for the vales that are 1 then you could use the expression
=iif(Fields!val.Value = 1, Fields!val.Value * 1.1, Fields!val.Value)
To make all values that are 1 equal to 1.1 so showing a tiny bar appearing a the bottom of the chart, as seen here
Unfortunately I don't know of a way to change that first 1 to a zero (formatting-wise). This is partly because you are now using a logarithmic scale and zero and negative values don't really exist. This is due to a fundamental property of logarithms in mathematics, that
LOG10(10)= 1
LOG10(1) = 0
LOG10(.1)=-1
Therefore, when you perform a log10 of zero, it just doesn't exist.

How to increase Chart size dynamically inside a table in ssrs

I have a range bar chart inside a table of row group and the chart is repeatedly generated according to a category. I want to increase chart height dynamically based on a category.
suppose
if category =A THEN CHART HEIGHT=10CM
if category =B THEN CHART HEIGHT=7CM
If you look in the Properties of the chart there is a field called DynamicHeight, which will, as suggested, dynamically change the height of the chart based on a value.
For example I have set a parameter called Offset to default to 8.
You can then set the value of DynamicHeight to
=CStr(Parameters!Offset.Value) + "cm"
Then, as you change the Offset parameter, the width of the chart changes.
DynamicHeight = 8
and
DynamicHeight = 4
Now how you calculate the height to be a meaningful and consistent is up to you... I get the impression you wouldn't want to use a parameter like the example above, but I'm sure it would be possible to create a calculation that will give you a sensible layout.
Update
Note it is not possible to alter the DynamicHeight on a table that is recreated multiple times in a Matrix.
I believe this is because the size of the chart area is determined to generate the layout of the report, and this area is then populated with the actual chart later in the rendering process. It doesn't know until the later stage that is should be a smaller size, so therefore is not the smaller size.

SSRS range chart series labels overlap and do not align left

I have built a "gantt" style range chart in SSRS using Narayana Palla's model. I am using date parameters to view the data by a date range - my dataset is museum exhibitions over a number of years. I have opted to use the DrawSideBySide = false custom attribute to display series data but I can not position the series labels as I want. I want them to align left however they align right and overlap with each other. I have tried many different combinations of properties including the smartlabel properties but can not impact on the position of the labels in the series. I have not been able to find a solution in my searching.
I would be happy to have my series displayed using DrawSideBySide = true but the bars are so narrow that neither they nor their labels can be seen. Again I have tried many combinations of properties to set the width of the bars but to no avail. I believe this is due to the number or series in the whole of my chart / dataset.
I would like advice on :
1. How to adjust the position of the labels in the series OR
2. How to fix the width of the series bars so that I can see them on my chart OR
3. If I am right about the size of the data set making the bars miniscule how can I best resolve this - say group on year so that only a limited (and therefore hopefully wide) set of series bars appear at a time from page to page.
Very grateful for any assistance, Sally
In SSRS, for the label overlapping issues, the only way is manually changing the chart area size to make enough space for those labels. Otherwise we have change an appropriate chart type.

Dynamic matrix width to always equal chart width

Most things are dynamic in SSRS i.e you can create a custom expression for most formatting.
I have a report with a matrix tool. This matrix will vary in width depending on how many columns are included.
Above the matrix is a chart.
How do I make the column width dynamic so that is always the same width as the matrix?
Sorry, but it's not possible. The width of columns in a matrix can't be set with an expression:
Q: Will the width property of a column be able to be set at run-time
A: This is a common request and I definitely see the value in it. However, we didn't get to this for SSRS 2008.
Source on social.msdn
One alternative that may suit you is varying the width of the chart, because they do have a properties for Dynamic Height and Dynamic Width (see also this blogpost). Note that this only available in SSRS-2008 and up.
The other alternatives will be much "heavier", including generating (or editing) the XML for the RDL dynamically. Workarounds would inlude hiding excess columns (the visibility can be dynamically set)