Dynamic Chart Height based on data rows

5 posts, 0 answers
  1. Phil
    Phil avatar
    10 posts
    Member since:
    Jun 2019

    Posted 17 Sep Link to this post

    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.

  2. Neli
    Admin
    Neli avatar
    184 posts

    Posted 20 Sep Link to this post

    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
  3. Phil
    Phil avatar
    10 posts
    Member since:
    Jun 2019

    Posted 20 Sep Link to this post

    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

  4. Phil
    Phil avatar
    10 posts
    Member since:
    Jun 2019

    Posted 24 Sep in reply to Phil Link to this post

    Hi Neli,

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

    Thanks

  5. Neli
    Admin
    Neli avatar
    184 posts

    Posted 25 Sep Link to this post

    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
Back to Top