views:

233

answers:

1

I have a report that contains a pie chart within it. I would want the chart to be shown no matter if the query returns results or nothing at all. typically you just need to do the plot.setNoDataMessage() function, however since this is not exposed within iReport, i did it within the Customizer class just as the following:

        CategoryPlot plot = (CategoryPlot)chart.getPlot();

    plot.setNoDataMessage("No data available so we go into this really "
            + "long spiel about what that means and it runs off the end of the "
            + "line but what can you do about that!");

however when i run it with no data returning, it is giving me a blank page and iReport pops up with "the document has no pages"

Please advise.

A: 

ok, i got an answer from elsewhere on this

normally if you are jfreechart in java, the above code would do

but if you are doing it within iReport, you have to find the property "When no data" in the root report level, set it to "All sections, no detail". Then your NoDataMessage will be showing on the chart.

Lawrence Leung