如何在BIRT中禁用或启用图表可见性 [英] How to disable or enable the chart visibility in BIRT

查看:198
本文介绍了如何在BIRT中禁用或启用图表可见性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,我需要根据用户使用BIRT的选择动态显示图表.有人可以告诉我如何使用脚本吗?我已经创建了用于选择的参数.

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.

推荐答案

最简单的方法是使用带有参数的表达式来设置图表(或包含该图表的网格)的可见性属性.如果查看"报告参数的值等于图表",则此示例隐藏交叉表的网格.

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.

因此,最好的方法是从报表的 beforeFactory 脚本中删除元素. 此示例报告同时使用了两种方式:使用 visibility隐藏交叉表属性,然后将两个图表放在 beforeFactory 中.这是此beforeFactory脚本:

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.

这篇关于如何在BIRT中禁用或启用图表可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆