Auto Adjust Height and Width of BIRT CHART based on Axis Values

prince_iam
edited February 11, 2022 in Analytics #1

Dear BIRT GURUs,

I found this forum very helpful, I hope this time will it be. I want to adjust the height and width of the birt chart based on the number of axis and values.

When I generated the report for the three (03) months the chart bar sizes and values were adequately visible.

When I generated the report for the twelve (12) months (year) the chart bar sized and values were shrunk.

Can anybody help to fix this issue and adjust the chart dimension dynamically based on the number of axis and values to properly display data for any period of time. Thank you in anticipation.

Comments

  • In the attached example, I created a computed column in the data set and added it as an Optional Y Series Grouping in the chart. It creates 14 series (groups). The chart script increases the width of the chart if the number of series is greater than 10. Note that the Master Page must be wide enough to handle the increased width.

    Warning No formatter is installed for the format ipb
  • Dear Jeff,
    I found a much simpler solution to this problem at the following thread.
    http://birtworld.blogspot.com/2008/04/birt-resizing-charts.html

  • Hi Prince,

    Thanks for posting the link.

    It looks like the code is the same as mine. Both linked code and my code use .getBlock().getBounds().setWidth() in beforeGeneration to set the width of the chart. I added code to check the series count and conditionally change the width based on the count because that was your requirement.

    Warning No formatter is installed for the format ipb