This is a migrated thread and some comments may be shown as answers.

Standard Bar Width

5 Answers 188 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kanchana
Top achievements
Rank 1
Kanchana asked on 16 Jun 2017, 09:57 AM

Hi,

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

Sort by
0
Stef
Telerik team
answered on 16 Jun 2017, 03:05 PM
Hi Kanchana,

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.

Regards,
Stef
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Kanchana
Top achievements
Rank 1
answered on 19 Jun 2017, 07:44 AM

Hi Stef,

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?

Thank you.

0
Stef
Telerik team
answered on 19 Jun 2017, 03:59 PM
Hi Kanchana,

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.

Regards,
Stef
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Kanchana
Top achievements
Rank 1
answered on 20 Jun 2017, 08:01 AM

Hi Stef,

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.

Many Thanks

0
Stef
Telerik team
answered on 22 Jun 2017, 01:47 PM
Hello Kanchana,

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.

Regards,
Stef
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Kanchana
Top achievements
Rank 1
Answers by
Stef
Telerik team
Kanchana
Top achievements
Rank 1
Share this question
or