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

Simpe bar graph problem

12 Answers 195 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Andy Green
Top achievements
Rank 2
Andy Green asked on 11 Aug 2017, 03:09 PM

Hi

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.

 

Andy

12 Answers, 1 is accepted

Sort by
0
Ivan Hristov
Telerik team
answered on 15 Aug 2017, 12:51 PM
Hi Andy,

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.

Regards,
Ivan Hristov
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
Andy Green
Top achievements
Rank 2
answered on 17 Aug 2017, 07:42 AM

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.

 

A

0
Andy Green
Top achievements
Rank 2
answered on 17 Aug 2017, 02:17 PM

HI

I have gone through your example links, are  you sure these are still valid for the latest reporting.

I'm having trouble following along.

Andy

0
Ivan Hristov
Telerik team
answered on 21 Aug 2017, 02:41 PM
Hello Andy,

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.

Regards,
Ivan Hristov
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
Andy Green
Top achievements
Rank 2
answered on 23 Aug 2017, 10:25 AM

Thanks Ivan

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.

Andy

 

 

0
Andy Green
Top achievements
Rank 2
answered on 23 Aug 2017, 10:39 AM

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?

Andy

0
Ivan Hristov
Telerik team
answered on 23 Aug 2017, 02:56 PM
Hello Andy,

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.

Regards,
Ivan Hristov
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
Andy Green
Top achievements
Rank 2
answered on 23 Aug 2017, 03:07 PM

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.

A

0
Andy Green
Top achievements
Rank 2
answered on 23 Aug 2017, 03:26 PM

Looks like setting the values to a fixed number doesn't work, just tried with your example id its the same as mine.

Andy

0
Accepted
Ivan Hristov
Telerik team
answered on 24 Aug 2017, 07:27 AM
Hello Andy,

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.

Regards,
Ivan Hristov
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
Andy Green
Top achievements
Rank 2
answered on 24 Aug 2017, 01:52 PM

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.

Andy

0
Ivan Hristov
Telerik team
answered on 24 Aug 2017, 02:39 PM
Hello Andy,

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.

Regards,
Ivan Hristov
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
Report Designer (standalone)
Asked by
Andy Green
Top achievements
Rank 2
Answers by
Ivan Hristov
Telerik team
Andy Green
Top achievements
Rank 2
Share this question
or