I am using BIRT in our project. That has a requirement is dynamic display three different kind of graph and switch between different graph. It is my first time to use BIRT. So I don’t know how to control the chart in our report of BIRT. I found a document of BIRT introduced how to insert script code in the report scope. The detailed description following:
The First: I defined a table element that has two rows and columns.
The Second: in the first row and first column. I insert the text element and choice the element type is HTML, so you can edit html element, such as I insert three “input” element of html, its type is radio. When I click one of three radio elements, a kind of graph will be shown and the others will be hidden. So you must defined row and column “bookmark” property. You can use the bookmark in your script, like this “document.getElementById(“bookmark”)”,obtain the element object.
Third: edit your script code, like following:
function DisplayCustomer(id0,id1,id2) {
document.getElementById("chart"+id0).style.display="block"
document.getElementById("chart"+id1).style.display="none"
document.getElementById("chart"+id2).style.display="none"
}
Fourth: through the above code display or hidden the different graph.
The First: I defined a table element that has two rows and columns.
The Second: in the first row and first column. I insert the text element and choice the element type is HTML, so you can edit html element, such as I insert three “input” element of html, its type is radio. When I click one of three radio elements, a kind of graph will be shown and the others will be hidden. So you must defined row and column “bookmark” property. You can use the bookmark in your script, like this “document.getElementById(“bookmark”)”,obtain the element object.
Third: edit your script code, like following:
function DisplayCustomer(id0,id1,id2) {
document.getElementById("chart"+id0).style.display="block"
document.getElementById("chart"+id1).style.display="none"
document.getElementById("chart"+id2).style.display="none"
}
Fourth: through the above code display or hidden the different graph.
本文介绍如何使用BIRT实现报告中动态显示不同类型的图表并进行切换。通过定义表格元素及HTML输入元素,结合JavaScript代码控制图表的显示与隐藏,达到灵活展示数据的目的。
3885

被折叠的 条评论
为什么被折叠?



