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

Dynamic Chart Height based on data rows

4 Answers 363 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Phil
Top achievements
Rank 1
Phil asked on 17 Sep 2019, 09:17 AM

Hi,

Is there a way to dynamically set the chart height based on the number of data rows? The chart looks fine when there are about 10-12 rows of data, but anything more and it starts to squish to meet the height requirements of the chart. I'm assuming there is a way and I'm just missing it!

I'm using the standalone Telerik Report Designer FYI. I've attached photos for an example.

4 Answers, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 20 Sep 2019, 07:24 AM

Hello Phil,

The height of the Graph can be controlled through a Binding. The attached report demonstrates the following approach:

1) Create a Bar chart whose values come from a CSV DataSource. Note that the graph is located in the Report Header because its data source is bound to the report data source.

2) Click on the graph -> select Binding from the menu with properties.

3) Set the following binding:

Property path: Height

Expression: =IIF(Count(Fields.X)>4, "5in", "3.1in")

You may increase the number of records in the data source to test.

Regards,
Neli
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
Phil
Top achievements
Rank 1
answered on 20 Sep 2019, 11:48 AM

Hi Neli,

Thanks for getting back to me. I tried your solution however it doesn't seem to work. I'm using an Object DataSource, that returns a dictionary, hence the Fields.Key selection. I don't have my chart in the Report Header, and my DataSource is bound to the chart, not the report. Should it be?

Is there anything else I am missing?

Thanks,

Phil

0
Phil
Top achievements
Rank 1
answered on 24 Sep 2019, 01:50 PM

Hi Neli,

Just wondering if you have any further tips that could help me in this situation?

Thanks

0
Neli
Telerik team
answered on 25 Sep 2019, 08:50 AM

Hi Phil,

Basically, the Binding of the Graph or other data item takes the data fields from the data context of the parent object. In this case, this is the Detail section, which data context is the Report DataSource. For that reason, you can access the fields only if they are bound to the report. Another option which you can try is to put the graph in a List item whose data source is the Object DataSource. Then you may bind the Graph DataSource to its parent DataSource - check Binding to data from the parent data item.

Please, test and let us know whether this has helped.

Regards,
Neli
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
Phil
Top achievements
Rank 1
Answers by
Neli
Telerik team
Phil
Top achievements
Rank 1
Share this question
or