I am using stand-alone report builder to build my reports and am having problems with the width of the bars in a bar chart when the number of rows returned by the data source of the graph changes (using report filters). Please have a look at the attached images.
I would like to have a standard bar width irrespective of the number of row returned.. in other words the height of the chart should be dynamic. How do I achieve this?
Thanks in advance.
5 Answers, 1 is accepted
The Graph item remains the same in size, where the plot area changes depending on the amount of data and the generated axes slots and series.
If yo want to have the same size for bars, regardless the number of slots on the Y axis, you can set the Yaxis.Scale Maximum and Minimum properties. This will assure the Graph will look the same. The Scale's Minimum and Maximum can be set via expressions as well - How to: Use Bindings to Control the Coordinate System Properties.
Thank you for your response. Can this be done even when the Y-Axis (or any axis for that matter) has a Category scale? As you can see from the attached pics, the Employee category is the Y-axis scale in my case. Can you please give an example on how this can be achieved with AdventureWorks database?
Only scales with discrete values can have Minimum and Maximum. You can ensure data always contains the names of all categories, which will produce additional slots on the YAxis.
Other approaches will be to reduce the size of the Graph item when you display less amount of data in order to avoid having too big bars in preview; or use the YAxis.Scale.SpacingSlotCount property (How to: Change the Gap Between the Bars).
I hope this helps.
Thank you for your reply. Your answer " You can ensure data always contains the names of all categories, which will produce additional slots on the YAxis" will not work in my case as the user would not like to see other employee names on the Y-axis although the data(bar) is displayed only for the filtered employee.
As for the option "reduce the size of the Graph item when you display less amount of data in order to avoid having too big bars in preview", I thought you mentioned in your earlier reply that the size of the graph cannot be altered dynamically. I cannot reduce the size of the graph initially as the category scale is not displayed if the size is too small and the data is huge (number of rows returned by the data source of the graph). Works fine for single row though. Please see attached pics for clarity.
Changing the YAxis.Scale.SpacingSlotCount property is not an ideal solution again as the data is dynamic as mentioned above and needs SpacingSlotCount = 1 when the number of rows returned by the data source is large.
Hope I'm clear. It would be great if you could give me solution for this as I have the same scenario in many of my reports.
Please check the attached video in IE browser. It illustrates an approach to change the size of the graph item based on the number of selected employees.
If I understand correctly, the number of bars in the graph item is determined by the multivalue Employee parameter. This report parameter is evaluated as an array of objects. you can check its length and set the height of the Graph item based on that length - see Bindings. Without controlling the Graph.Height via binding, the item will not change its size.
If the parameter is not a a multivalue parameter, update the binding's expression to check the value of the parameter and to set the desired height. you can use the built-in Conditional functions to check the value of the parameter.