Dom Vito
Dom Vito

Reputation: 567

Fixed tablix or chart width in SSRS

I have a chart that sometimes has 5 columns, sometimes has 4. However, I want it to be the same width everytime (and just scale appropriately). Currently the chart is embedded in a tablix cell.

Can I set the width of the tablix or (probably more importantly) the chart so that it stays the same size regardless of 4/5 columns?

Upvotes: 3

Views: 2667

Answers (2)

StevenWhite
StevenWhite

Reputation: 6024

Unfortunately, you can't do this in SSRS. The width of tables, charts, and columns cannot be dynamically set. By design, paginated reports are meant to grow downwards as opposed to horizontally so that's the rationale behind it.

Edit: Charts do have the DynamicWidth property you can set, but tables and textboxes don't.

Upvotes: 1

Aldrin
Aldrin

Reputation: 766

You should put a parameter or a textbox that will show how many columns there would be, on my side, I always refer to month field. So for example the user selected "May" I know there will only 5 columns so I put a "7.5 inches" DynamicWidth, it's hardcoded. I put my expression under the DynamicWidth property of the chart. It's just under Properties pane when you selected the chart.

Here's my expression:

SWITCH(Parameters!Month.Value=1,"3.5 in",
Parameters!Month.Value=2,"4.5 in",
Parameters!Month.Value=3,"5.5 in",
Parameters!Month.Value=4,"6.5 in",
Parameters!Month.Value=5,"7.5 in",
Parameters!Month.Value=6,"8.5 in",
Parameters!Month.Value=7,"9.5 in",
Parameters!Month.Value=8,"10.5 in",
Parameters!Month.Value=9,"11.5 in",
Parameters!Month.Value=10,"12.5 in",
Parameters!Month.Value=11,"13.5 in",
Parameters!Month.Value=12,"14.5 in")

Upvotes: 2

Related Questions