Custom Visualization Component

The custom visualization component lets you leverage JavaScript in Jaspersoft Studio and JasperReports Server. You can create JavaScript modules and use them in your reports to extend their functionality. The main purpose of the custom visualization component is to render SVG (Scalable Vector Graphics) images. Your modules can leverage third-party JavaScript libraries, such as JQuery. For example, perhaps you want to create reports with dynamic behaviors for interaction and animation; you could leverage D3 (d3js.org) to bind data to the Document Object Model (DOM) and manipulate the SVG. Such a report is shown in D3-enabled report.

Please note that this component is only supported by the Jaspersoft Community (community.jaspersoft.com). For this release, TIBCO Jaspersoft Technical Support and Engineering do not support it.

D3-enabled report

The custom visualization component is a powerful and flexible feature, suitable for advanced users of JasperReports Library. Using the component requires advanced coding skills in the following technologies:

JavaScript
CSS
HTML/DHTML
Optionally, any third-party library you want to expose in Jaspersoft Studio and JasperReports Server.

Before creating reports that use your third-party library, you must configure various applications to work together; you must:

1. Install PhantomJS (phantomjs.org), which renders your JavaScript module's visual component.
2. Configure Jaspersoft Studio and JasperReports Server to use PhantomJS.
3. Create a JavaScript module that renders an SVG. This main module, as well as any JavaScript it relies on, are optimized ans combines into a single JavaScript file (using a RequireJS build file (build.js). Jaspersoft Studio simplifies the optimization process to generate the JavaScript implementation of the component. Place your JavaScript files somewhere that Jaspersoft Studio can find it, such as attaching it to the report unit or placing it on the classpath.

Next, create and deploy reports that rely on your custom visualization component to render SVG images. Drag the Custom Visualization component from the Elements palette into the Design pane, and create a report-level property of type com.jaspersoft.jasperreports.components.customvisualization.require.js; it must specify the main JavaScript file for your custom visualization. The custom visualization component appears as a rectangular area of your report. A single custom visualization component can be used by any number of reports that require the same JavaScript functionality. When exported to HTML format, these reports can be interactive (assuming that your module attaches events to the DOM).

This component can help you leverage any number of JavaScript libraries, such as:

D3.js
Raphäel
HighCharts
JQuery

For more in-depth information, please see the articles on our Community wiki that describe the custom visualization component.

Version: 
Feedback