Search code examples
birtpie-chartautoresize

BIRT Pie chart can grow property?


I have a pie chart using BIRT. Works fine but the problem is it only shows data that is "fitted" in the chart's size. Is there a "can grow" property equivalent for pie charts? I mean all data shows only if I resize the pie chart into larger one. But if I choose a larger amount of data, it won't fit again. I need the size to be "auto resize" according to how many data to be displayed.

I tried modifying the advanced settings but nothing worked

  • Format - Overflow: Auto, Scroll and Visible
  • Push down - set to true

I do not see any other properties related to pie chart formatting. Can anyone point me to right direction? thanks.


Solution

  • nevermind, found it here but I tweaked it a bit. OnRender event of the chart itself type this:

    function afterDataSetFilled(series, dataSet, icsc)
    {
    
        if( series.getSeriesIdentifier() == "categorySeries" ){
            if( dataSet.getValues().length <= 4 ){
                 icsc.getChartInstance().getBlock().getBounds().setWidth(450);
                 icsc.getChartInstance().getBlock().getBounds().setHeight(250);
                }
            if( dataSet.getValues().length > 4 && dataSet.getValues().length < 8 ){
                 icsc.getChartInstance().getBlock().getBounds().setWidth(450);
                 icsc.getChartInstance().getBlock().getBounds().setHeight(400);
                }
            if( dataSet.getValues().length > 8 ){
                 icsc.getChartInstance().getBlock().getBounds().setWidth(450);
                 icsc.getChartInstance().getBlock().getBounds().setHeight(600);
                }
    
            }
    }
    

    "categorySeries" is the title of the "simple series" type that can be found in "Format Chart" tab when chart is double clicked.