Handling chart height in sub reports

Posted by: amirgeri on 3 August 2017, 3:18 pm EST

  • Posted 3 August 2017, 3:18 pm EST

    Hi there,



    I have the following scenario:

    I'm building a report definition in runtime, and this report definition is a report - sub report structure, where the sub report contains a table and a chart.

    From what I understood, I have to calculate the height of the report in the sub report and set it as the height of the sub report in order for it to be visible properly.



    So far I've built a simple code that calculate the height of the chart with consts for the "bar" height, the header height and the X axis height. However, I'm using the full data for charts, while each sub report "instance", for each value of the parameter passed to the sub report, there is a different amount of rows for that chart, and thus the size should be different, and smaller then the size I've calculated for the entire data set.



    Is there any generic way to do this and let the chart built itself with the amount of rows it has per appearance of the sub report?



    I've attached an RDLX output of the algorithm.



    Regards,

    Amir
    2011/10/Reports-2.rar
  • Replied 3 August 2017, 3:18 pm EST

    Amir,

    The subreport and its containing controls(Chart etc) would automatically adjust their height depending on the data that they mean to render. So, you would not require to calculate the height of the containing controls and set the height of the subreport control on its basis.The report engine should do it automatically for you. Please let me know if your observation is different though.

    Regards,
    Prantik
  • Replied 3 August 2017, 3:18 pm EST

    Hello,

    I am unable to reproduce the said behavior. Please take a look at the attached sample. In my testing both the chart and the Table comes up fine. Could you please try modifying this to reproduce the said behavior?

    Regards,
    Prantik

    2011/10/SubReportTest.zip
  • Replied 3 August 2017, 3:18 pm EST

    This is the rdlx I've generated
    2011/10/Reports-3.rar
  • Replied 3 August 2017, 3:18 pm EST

    Hello,

     You must allow some height to the Chart control to get it rendered. Please check the sample attached in the previous post. The charts come out fine there.

    Regards,
    Prantik
  • Replied 3 August 2017, 3:18 pm EST

    You've set the height of the chart for about 7 cm.

    I've done the same, and now once there is a small data set the bars of the chart are wide and once the data set is really big the bars are way too small.

    See screen shots attached.
    2011/10/screenShots.rar
  • Replied 3 August 2017, 3:18 pm EST

    Unfortunately, the Chart cannot automatically be resized. However, a possible workaround would be to use the DataBar Data Visualizer as the background image in a Table Cell.



    This will allow table to act as a dynamically sizing chart. Please take a look at my attached RDLX report for a demonstration. (Note, I reversed the values for Value, Min, and Max so the chart would mimic RTL languages like what you have in your screenshot).



    The Table Cell's Background Image properties should look like this:



    Source: Database

    Value: =DataBar(-Fields!Freight.Value,-Max(Fields!Freight.Value),0,0,"Green")

    MIMEType: image/png

    BackgroundRepeat: NoRepeat





    Let me know if this helps.





    Thanks,

    Jon
    2011/10/DataBarExample.rdlx
  • Replied 3 August 2017, 3:18 pm EST

    It might help to specify that I'm working with the web viewer.

    I've tried to implement this suggestion and it didn't work:

    I've removed the chart height, and sub report's height the SubReport element's height.

    When I do so the sub report only shows the table and not the chart.

    I've then also removed the table's height the viewer displayed an error.



    Any other suggestions?
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels