How to disable or enable the chart visibility in BIRT

谁说我不能喝 提交于 2020-02-07 12:26:30

问题


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

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.



来源:https://stackoverflow.com/questions/29057454/how-to-disable-or-enable-the-chart-visibility-in-birt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!