I have a dataset containing a location and a number as a % so from 0 - 100.
All I want to do is display the Location with this number against all other locations.
I've been playing with this or a while now, and the best I can get is the graph showing at a fixed height, which is great if there are only 2 or 3 locations, but each bar is really small if there are more, alternatively with the control sized large with only 2 locations is again looks silly as both bars take up the whole control.
All I want it to do is display consistently for n number of locations.
Can someone point me in the right direction please.
12 Answers, 1 is accepted
The Graph item calculates automatically the width of the columns/bars depending on its size, the available space and the amount of data it presents (how many columns it should display). If you are using a category scale, you can control the column width in a single slot using the SpacingSlotCount property. Note that you can change this property using Bindings, thus making it dependent on your data.
In some scenarios it is possible to use NumericalScale, setting its Min and Max to constant values. Then the data points will occupy the same space in every graph instance in your report, regardless how many they are. However, this approach limits you in displaying only a numerical information.
We could give you more relevant advice if you send us a sample of your report and an image or a drawing what you are trying to achieve and how you would like the report to look like.
What I want is to have a fixed height (its a horizontal bar) and have the control grow. What's happening is the height is changing to fit in the control height.
I have gone through your example links, are you sure these are still valid for the latest reporting.
I'm having trouble following along.
Sorry, I may have missed the requirement for dynamically sized graph item in your first post. Currently such feature is not supported - the graph item size doesn't change based on its data out of the box.
As a workaround I can suggest two approaches:
1. Use Bindings to set the size dynamically through a user function, that will return an estimated graph height based on the input data items.
2. Before connecting the Graph to data (usually in the report constructor), you can change the report definition, setting the Graph height based on the data items in your data source. You can read more here.
However, the two suggested workarounds would produce a graph with approximately equal bars. Based on your scenario, I have prepared a small demo that demonstrates the first approach (using Bindings), but, instead of utilizing an user function, I set the graph height to the value of a hidden report parameter, that takes the number of displayed bars as an input and outputs the desired height in pixels, but the idea is the same. I hope you will find the demo useful.
The links provided are from our documentation, which is always built against the latest version of Telerik Reporting.
I'm using TRDP files and there is no access to the markup such as you have in the demo.
However I'll have a play with this approach, as it seems a simple way forward.
As a simple set I have added a binding to the graph of Height =20, and change the number to observe, but nothing is changing. Should I expect to see a change. How to I know the binding is being applied?
TRDP is just a compressed packed TRDX definition. You can unpack and deserialize the TRDP file and then change the definition. Check here and here for more info.
Bindings are applied at runtime, i.e. you should see the graph height changing when you preview it.Check this link for a video to see it in action.
Cool Thanks Ivan
Your example works, Its my reports where I'm manually setting a binding value value to see it working where its not.
I'll continue playing.
Looks like setting the values to a fixed number doesn't work, just tried with your example id its the same as mine.
Please note that Height property accepts instance of Unit structure, or a string that can be parsed into a Unit. Therefore, you need to set your expression to ='200px' or ='3cm', instead of just =20.
Take a look at the report provided earlier and check the hiddenParameterHeight value - its expression returns the necessary height in pixels:
=60 + (CInt(Parameters.countParameter.Value) * 22)+'px'
Note the concatenated string 'px' at the end, which makes the evaluated result valid for Height property.
Hope it helps.
Thanks Ivan, Yes I got that after I posted.
I now have this sort of working by using the Chart binding as =60 + (Count(1) * 30) + 'px'. Its works well enough for now. I couldn't get the Count() to work in the Parameter value.
I have other issues around my understanding of reporting, and the documentation and especially the videos are out of date for 2017.
I'll start another thread to separate out my new requirement.
Thanks for helping me through this.
Aggregate functions like Count() do not work in parameters, because they are referring the data context, which is not ready when preparing the parameters. The data for the report/graph will be resolved based on these parameters, that's why it is impossible for parameters to process it using Count() - it's just not ready yet. However, you can use a user function that counts the records used by your graph in a separate method, that connects to your business object or database.
The videos are way harder to maintain and, as you noticed, no recent entries were added there, because we focus mainly on the documentation and KB articles as a reliable source. We're trying to improve and keep our documentation in sync with latest release of our product, that's why I'll be grateful if you point out which documentation articles are obsolete or irrelevant.
We recommend you to use support threads instead of forum posts, because the support threads are answered with higher priority and we could help you to resolve your problems faster and more accurate.