Set static height for bar chart using SSRS - reporting-services

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.

Related

SSRS range bar chart, different color when no data

I am looking to change the color in the "gaps" in the range chart that I have built.
Essentially I am trying to build a visualization for the staff to see the availability on bays. The red markings mean the bay is booked, I wanted green then to be in between the red to highlight free bays.
Occupied bays:
I suspect I need to go back to my dataset and add in some date tables to show "null data" to allow a "switch" to work, but I thought someone might know if I could change this without going this way.
An example of the dataset would be:
Following up
here is a screen shot of my output, i added data labels to see if i was going wrong...HOWEVER I also added shadows to my data and my data is actually still there, just hiding behing my secondary bars......
you are right about my data set, i had to add a series grouping to get my appointments all to appear other wise i was just getting the first appointments on the row only to appear....
Following up 2
A further follow up, I have followed #iamdave 's excellent RangeChart.RDL
I have applied my dataset to it but I am now getting the following output, I know I am probably missing something simple, my gut is telling me the cust_id are seperating all the appointments on to seperate lines yet I have both the primary and secondary axis set to "DrawSideBySide = False"
Here is my set up..
here is my latest output, if I could just group all the rows/bars/lines down to the 6 bays it would be great.
You can do this by adding in another data series based on your original dataset, that will require significantly less processing than filling in all your empty periods as suggested by WEI_DBA.
In your dataset, add a new column that returns dense_rank() over (order by BAY) as BayID (order by should be your desired axis label).
This may be best done as a wrapping select statement to preserve the rest of the query logic as is.
In your Range Chart, add in another Values item, with the same Category Field as your current one.
Set the Top Value to 1 and your Bottom Value to 0.
You could also set this to the min and max time of your dataset or the start and end period of your report to only cover the period the Bay was available.
Set it to display on the Secondary Axis for both Vertical and Horizontal axes.
Also select the Do not show this series in a legend option.
Set up the Secondary Vertical Axis in exactly the same way as your Primary Vertical axis.
Set the Secondary Horizontal Axis Minimum and Maximum to the same values as your Bottom and Top above.
Hide both the Secondary Axes.
Select the new Values item and in the Properties window, expand the CustomAttributes section and change DrawSideBySide to False.
If necessary, adjust the order of the Values items in your Chart Data window to make sure the new Range Bar displays underneath your actual data.
Select the original Values item and in the properties sidebar navigate to Data > DataPoint:
Change AxisLabel to =Fields!BAY.Value (Your axis label).
Change Values > X to =Fields!BayID.Value (Value from point 1.).
You should now have a range chart that that displays your data on top of a solid bar, that you can set to any colour you require:

Dynamic Width Adjustment of a Column in Tablix in SSRS

Hi everyone,
I wanted to adjust the width of a tablix column dynamically. can some one please let me know how can this be done? when i searched some forums there was a suggestion that i try creating an instance of the report in the CODE of the report properties and access the tablix column using the instance but i wasn't able to do that. Can some one please help if indeed i can try creating an instance of the report and access the tablix and adjust the width dynamically ?
Thanks,
AJ
On the off-chance that anybody is still looking for a way to have dynamic column widths in SSRS (as I was), I've found way that works for most scenarios.
Basically you add another column header to your table/matrix/tablix and set your column to your minimum required width, then add a subreport to the new header. The subreport consists of a matrix with a static row group and a dynamic column group that generates a number of fixed-size columns based on the desired width, which is passed via a parameter from the main report to the subreport.
e.g. Your main report has a column where you want to set the width from data or a parameter, which is in a range from 5 to 10cm, with increments of 1cm. Let's say for a particular column you pass down 7cm to the subreport, which then does a basic SQL loop to produce some data with 7 rows. The matrix column grouping in the subreport points to that data, which produces 7 columns, each 1cm, for a total width of 7cm (plus the row grouping which is shrunk as much as possible). The main report's column then expands to the size of the subreport, which is 7cm.
Select the first column, in properties, find the width property (under size) add an expression that uses the same condition for hiding column 3 and increasing the width of the first column, e.g.
=iif(parameters!par.value=true,"1,5cm","2,5cm")
--EDITED --
I'm very sorry my previous solution was false, I hadn't checked it, I'm sorry to have wasted your time, but I have a solution that works.
create two first columns, i.e. two columns that show the same information, one that is the width that you like when column 3 is visible (lets call that one col1a) and one that is the width that is suitable to when column 3 is hidden (col1b) and then make those two alternate. then when you hide column 3 then you also hide col1a and make col1b visible and then the other way around
There is no property to auto size the column width. Length we can do it dynamically. That is the limitation Microsoft tools.
For now, one solution is to have a reasonable fixed column width (such, as 30) and set the textbox CanGrow to True so it wraps to next line if needed. Another solution is to have two columns and hide one of them conditionally.

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.

Reporting Services dynamic chart width

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.

Position data points in bar graphs in SSRS

I have SSRS reports which has a column chart.
The column chart has 2 value: Actual and Target.
The actual value is displayed as column chart with data labels displayed
and target value as Range column (my data has different targets for different values and would like to display target line for each bar)
The problem which I am running into is that sometimes this target line gets displayed over the data labels and its hard to read the data value.
Is there any way to set these labels to display over the target line when this happens?
This is what is happening right now:
https://drive.google.com/file/d/0Bx_Po7ND9VtOcW8xN3JSNlk5NjQ/view?usp=sharing
Options I tried till now:
1) setting the target values as first series and actual as second series: In this case I don't get to see the target lines as bars gets painted over the target lines.
You can set your Range Series' Fill color to use Transparency to allow the elements behind the line to be seen.
On another note, in the future you may want to do this with a StripLine on the axis rather than creating a new series.
http://blogs.adatis.co.uk/blogs/jeoc/archive/2013/07/23/adding-strip-lines-to-reports.aspx
http://blog.jontav.com/post/7067899413/axis-striplines-in-ssrs-charts