How to disable or enable the chart visibility in B

2019-08-22 03:16发布

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条回答
趁早两清
2楼-- · 2019-08-22 03:55

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".

enter image description here However this is not the most efficient approach, because if we just turn off the visibility of a report element its datasets are still running silently.

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.

查看更多
登录 后发表回答