问题
I have a problem, I need to dynamically show the chart according to the user's selection with BIRT. Could anyone tell me how to do that with script? I have created the parameter for the selection.
回答1:
The easiest way is to set the visibility property of the chart (or of a grid containing this chart) with an expression using a parameter. This example hides the grid of a crosstab if the value of "View" report parameter equals to "charts".

Therefore the best way is to drop elements from beforeFactory script of the report. This sample report makes use of both ways: the crosstab is hidden using visibility property, and the two charts are dropped in beforeFactory. Here is this beforeFactory script:
var design=reportContext.getDesignHandle();
if (params["View"].value=="cross"){
design.findElement("gridCharts").drop();
}
Please notice the key point is to name report elements we need to drop.
来源:https://stackoverflow.com/questions/29057454/how-to-disable-or-enable-the-chart-visibility-in-birt