Free Online Courses for Software Developers - MrBool
× Please, log in to give us a feedback. Click here to login
×

You must be logged to download. Click here to login

×

MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation

×

MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation

Chart incorporate on BIRT Report

In this article we will learn how to incorporate chart like pie chart, bar chart, line charts and others

We know that BIRT is a lightweight reporting tool. Here we will show how to incorporate chart like pie chart, bar chart, line charts and others. The BIRT charting is an integral part of data summation, data summation, and analysis and data management. BIRT introduce an excellent combination for charting, allowing diverse chart types such as bar charts, pie charts, line charts, scatter charts, and stock charts. By using this chart we can preview the data in our required optimization way.

Each chart type is also customizable, offering a wide valid range of features to better represent data. The preview is very glossy and mind blowing. Here we will show an example how to represent a birt chat report. That example mentions the use of BIRT's integrated charting information within the report designer. The example builds a two-dimensional pie chart and summarizing product revenue by product line.

This is the screen shot of Bar chart.

This is the screen shot of Bar chart.

Figure 1: This is the screen shot of Bar chart.

This is the screen shot of Pie chart.

This is the screen shot of Pie chart

Figure 2: This is the screen shot of Pie chart.

The BIRT is a reporting tool that mainly focuses on Eclipse. But we can connect it with other suit like net beans. We easily can use BIRT to create table, chart, list, and cross tab reports to display data sets. It is very easy to incorporate JavaScript and any condition what we like. We can also develop reports that are more complex and elaborate by using scripts. We present the code of JavaScript and jsp how to interconnect thus with BIRT report. At first, we present a simple JavaScript code that works with Birt Report.

If you want to pass any parameter; you can send it through the jsp page. The BIRT development environment generally includes a report designer, a charting engine, and a run time environment and much more fixtures. By using the java script code, you call a birt report viewer. Birt Framework has the building facilities to run Birt report internally.

Listing 1: Javascript code:

<script language="javascript">	  
	function previewBirtReport(){
			var url="http://#{facesContext.externalContext.request.serverName}:#{facesContext.externalContext.request.serverPort}"+"/portal-web/help/vms/Vehicle.jsp"
			window.open(url,'Help','top=80,left=140,width=900,height=700,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,true');
		 }
	function helpAdmin(){
		var url="http://#{facesContext.externalContext.request.serverName}:#{facesContext.externalContext.request.serverPort}"+"/portal-web/help/vms/help_admin. jsp"
		window.open(url,'Help','top=80,left=140,width=900,height=700,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,true');
	 }
 </script>

This above script uses to preview the birt report.

Now, we show a Jsp page. The Jsp page is used to preview the Birt report, which contains pie char. ‘String viDocId=String.valueOf(request.getParameter("docId"));’ use to receive the parameter that provide by a jsp pages. Therefor in than way, you can manipulate your parameter and able to pass it within the birt report design and layout. The birt viewer ‘birt: viewer’ opens the birt report. Within the birt viewer tag, you can put the Birt report name that you want to preview when you run it.

Listing 2: Now, we show a Jsp page.

	<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
	<%@page import="org.jboss.seam.international.LocaleSelector" %>
	<%@ taglib uri="/WEB-INF/tlds/birt.tld" prefix="birt" %>
	
	<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	"http://www.w3.org/TR/html4/loose.dtd">
	<html>
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
	<title>File Notes</title>
	</head>
	<body>
	<%
		String viDocId=String.valueOf(request.getParameter("docId"));
	 	String viRecordId=String.valueOf(request.getParameter("recordId"));
	%>
	<birt:viewer id="birtViewer" reportDesign="/fts/reports/filenotes.rptdesign"
	pattern="frameset"
	isHostPage="true"
	format="html"
	>
	<birt:param name="docId" value="<%=viDocId%>" >
	</birt:param>
	<birt:param name="recordId" value="<%=viRecordId%>" >
	</birt:param>
	</birt:viewer>
	
	</body>
	
	</html>

BIRT is an open source reporting tools. It is very user friendly and quite lightweight. BIRT provides core reporting feature such as report layout, data access and scripting, chats, bar, some others facilities as well. We can try BIRT to building report easily. We can use the Business Intelligence and Reporting Tools like BIRT report development tool to develop a range of reports. When you design the report, vary on your requirements, you can design the chart what you like to add.

It provides an excellent feature to add the chart by dragging option. You need to connect the data source name with the pie chart. We know there is two dimension in the pie chart, as one is ‘X’ dimension and the other are ‘Y’ dimension. We need to assassin the table field with the each dimension. This way helps us to create a Birt chart report and this is very user friendly.

Listing 3: Xml file


<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.20" id="1">
    <property name="createdBy">Eclipse BIRT Designer Version 2.5.1.v20090903 Build <2.5.1.v20090917-1447></property>
    <property name="units">in</property>
    <property name="iconFile">/templates/blank_report.gif</property>
    <property name="layoutPreference">auto layout</property>
    <property name="bidiLayoutOrientation">ltr</property>
    <parameters>
        <scalar-parameter name="reqId" id="159">
            <text-property name="promptText">reqId</text-property>
            <property name="valueType">static</property>
            <property name="dataType">string</property>
            <property name="distinct">true</property>
            <property name="paramType">simple</property>
            <property name="controlType">text-box</property>
            <structure name="format">
                <property name="category">Unformatted</property>
            </structure>
        </scalar-parameter>
        <scalar-parameter name="lang" id="160">
            <text-property name="promptText">lang</text-property>
            <property name="valueType">static</property>
            <property name="dataType">string</property>
            <property name="distinct">true</property>
            <property name="paramType">simple</property>
            <property name="controlType">text-box</property>
            <structure name="format">
                <property name="category">Unformatted</property>
            </structure>
        </scalar-parameter>
    </parameters>
    <data-sources>
        <oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc" name="Data Source" id="695">
            <list-property name="privateDriverProperties">
                <ex-property>
                    <name>contentBidiFormatStr</name>
                    <value>ILYNN</value>
                </ex-property>
                <ex-property>
                    <name>metadataBidiFormatStr</name>
                    <value>ILYNN</value>
                </ex-property>
            </list-property>
            <property name="odaDriverClass">com.mysql.jdbc.Driver</property>
            <property name="odaURL">jdbc:mysql://localhost:3306/vms</property>
            <property name="odaUser">root</property>
            <encrypted-property name="odaPassword" encryptionID="base64">cA==</encrypted-property>
            <property name="odaJndiName">java:vmsDatasource</property>
        </oda-data-source>
    </data-sources>
    <data-sets>
        <oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="Requisition1" id="665">
            <list-property name="filter">
                <structure>
  <property name="operator">eq</property>
                    <expression name="expr" type="javascript">row["ID"]</expression>
                    <simple-property-list name="value1">
                        <value>params["reqId"].value</value>
                    </simple-property-list>
                </structure>
            </list-property>
            <structure name="cachedMetaData">
                <list-property name="resultSet">
                    <structure>
                        <property name="position">1</property>
                        <property name="name">ID</property>
                        <property name="dataType">decimal</property>
                    </structure>
               <structure>
                    <property name="position">67</property>
                    <property name="name">DESCRIPTION</property>
                    <property name="nativeName">DESCRIPTION</property>
                    <property name="dataType">string</property>
                </structure>
            </list-property>
            <xml-property name="queryText"><![CDATA[SELECT *
  FROM
       VMS.VEHICLE_USE LEFT OUTER JOIN VMS.CONF_VEHICLE ON VMS.VEHICLE_USE.VEHICLE_ID = VMS.CONF_VEHICLE.ID
       LEFT OUTER JOIN VMS.VEHICLE_ROUTE ON VMS.VEHICLE_USE.ROUTE_ID = VMS.VEHICLE_ROUTE.ID
]]></xml-property>
        </oda-data-set>
        <oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="Requisition" id="690">
            <list-property name="columnHints">
                <structure>
                    <property name="columnName">ID</property>
                    <text-property name="displayName">ID</text-property>
                </structure>
                <structure>
                    <property name="columnName">REQUEST_TYPE</property>
                    <text-property name="displayName">REQUEST_TYPE</text-property>
                </structure>
                   <structure>
                    <property name="columnName">ID_25</property>
                    <text-property name="displayName">ID</text-property>
                </structure>
                <structure>
                    <property name="columnName">ENTRY_DATE_26</property>
                    <text-property name="displayName">ENTRY_DATE</text-property>
                </structure>
               <row id="205">
                    <cell id="206">
                        <label id="207">
                            <text-property name="text">তারিখ পর্যন্ত</text-property>
                        </label>
                    </cell>
                    <cell id="208">
                        <label id="209">
                            <text-property name="text">:</text-property>
                        </label>
                 <cell id="241">
                        <label id="242">
                            <text-property name="text">:</text-property>
                        </label>
                    </cell>
                    <cell id="243">
                        <data id="244">
                            <property name="resultSetColumn">NAME</property>
                        </data>
                    </cell>
                </row>
            </detail>
        </table>
        <grid id="696">
            <column id="697"/>
            <column id="699"/>
            <row id="700">
                <cell id="701"/>
                <cell id="703"/>
            </row>
            <row id="704">
                <cell id="705"/>
                <cell id="707"/>
            </row>
            <row id="708">
                <cell id="709"/>
                <cell id="711"/>
</row>
        </grid>
        <extended-item extensionName="Crosstab" extensionVersion="2.5.0" id="712">
            <property name="header">
                <extended-item extensionName="CrosstabCell" id="713"/>
            </property>
        </extended-item>
    </body>
</report>	

If we are going to run the report, we will get a glossy view of BIRT chart report.By this was we can add any chart in any BIRT report. Here we preview a Birt two dimensional report. We can design and manage any report depending on our requirement. We can put any css style and able to add any scripting language on the Birt Chart report.

In this preview, we show two dimensional Birt chart report.To make the report colorful, you can use cascade style sheet with it and able to design it as per your requirement. In this way we can preview and run a Birt chart report.

Birt two dimentional report

Figure 3: Birt two dimentional report.

This is all for this article. See you next time.



My main area of specialization is Java and J2EE. I have worked on many international projects like Recorders,Websites,Crawlers etc.Also i am an Oracle Certified java professional as well as DB2 certified

What did you think of this post?
Services
[Close]
To have full access to this post (or download the associated files) you must have MrBool Credits.

  See the prices for this post in Mr.Bool Credits System below:

Individually – in this case the price for this post is US$ 0,00 (Buy it now)
in this case you will buy only this video by paying the full price with no discount.

Package of 10 credits - in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download few videos. In this plan you will receive a discount of 50% in each video. Subscribe for this package!

Package of 50 credits – in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download several videos. In this plan you will receive a discount of 83% in each video. Subscribe for this package!


> More info about MrBool Credits
[Close]
You must be logged to download.

Click here to login