Jump to content
We've recently updated our Privacy Statement, available here ×
  • Custom Visualization Component v6.0.x: How to run the Samples


    djohnson53
    • Features: Charts Version: v6.0.0, v6.0.1 Product: Jaspersoft® Studio

    This page explains how to configure and run the samples in TIBCO Jaspersoft® Studio.

    Installing PhantomJS

    Download PhantomJS from http://phantomjs.org/ and copy the phantomjs binary in the PATH, so TIBCO JasperReports® Library will be able to find it easily.

    lightbulb_on.png.3bede264c716a8485111c0044a9249e4.png If you don't want the binary to be in the path, you can specify its exact location of the executable by setting the property:

    com.jaspersoft.jasperreports.components.customvisualization.phantomjs.executable.path=/path/to/phantomjs/executable
    

    lightbulb_on.png.10c2d072c8e153ee0057b14cf98cf0e3.png There may be some issues with latest version of PhantomJS and particularly v. 2.2.1. The sample provided here have been tested with Phantom v. 1.9.7

    Configuring the required jasperreports properties

    Jaspersoft Studio comes preconfigured to properly run reports using custom visualization components (except for PhantomJS which cannot be shipped along with JSS due to licensing issues).
    Jaspersoft Studio pre-configures for us a couple of properties, so actually there is nothing to do on a normal installation.

    Just for reference, here is what it's preconfigured. First of all, Jaspersoft Studio (or better JasperReports Library) needs to know where the require.js script is located, by means of this property:

    com.jaspersoft.jasperreports.components.customvisualization.require.js=file:/path/to/require.js
    

    Require.js is shipped with Jaspersoft Studio and the value of the property is set to the proper path automatically.

    On Windows, a bug of PhantomJS requires you to remove the file://. (The PhantomJS bug is https://github.com/ariya/phantomjs/issues/10231)

    Anyway, the platform check is performed by Jaspersoft Studio when the Custom Visualization Component plugin is activated, and the property is set accordingly to it.

    The other property set by Jaspersoft Studio, used only when running reports in interactive environments (Interactive Viewer in Jaspersoft Studio and TIBCO JasperReports® Server), is the package from which JasperReports is allowed to load resources. The property and its value are:

    net.sf.jasperreports.web.resource.pattern.customvisualization=com/jaspersoft/jasperreports/customvisualization/.*
    

    That's all.

    Installing the samples

    • Download the samples from this page: cvc_samples_20150127.tgz
    • From Jaspersoft Studio select File > Import then select General > Existing Projects into Workspace
      image2015-1-279_43_20.png.3d2b9a959f62b79e1d8d84a2eba1a24e.png
    • Select the radio "Select archive file" and select the CVC_samples_xyz.tgz archive and press finish.
      image2015-1-279_52_20.png.c5cbab2c71c00ea90eb574cc9239584e.png
    • The new CVC project with a set of samples will be imported inside your Workspace

      image2015-1-279_54_41.png.1d648817baf4f8209d616c956244ae10.png

    Each folder inside the CVC project is a sample. Each sample includes several files:

    • A build.js file, which is the file used to assemble, minify and uglify the component javascript
    • A javascript module (i.e. plain.js), which is the component module implementation
    • A "compiled" version of the component (i.e. plain.min.js)
    • A sample report to showcase the use of the component (i.e. pain.jrxml)
    • Optionally other javascript libraries (i.e. raphael.js) required by the module
    • Optionally a css file used by the component

    The component "compiled" version is an aggregation of all the required javascript files needed by the module that implements the component itself. This file must be regenerated all the times the module source is modified, by right-clicking the build.js file and selecting Build Component.

    image2015-1-2710_1_10.png.8b8fe698f9bc5847e6451e7e1ecbd8be.png

    Running the samples

    We are ready to go!

    Open a sample. All the samples use an empty data source or the Sample DB, which are both preconfigured in any Jaspersoft Studio environment.

    image2015-1-2710_19_18.png.cae6e7f1c09f03f3c3204b671b92b1ff.png

    Press Preview for the "Java" preview:

    image2015-1-2710_28_28.png.1dd148a7a329811aaee27a7c3891c536.png

    To test the same report in HTML click on HTML output format:

    image2014-9-1122_8_21.png.601edb965cfe0138f803858c1fbe129c.png

    And you will be able to play with the zoomable circle packing used in this example:

    image2015-1-2710_33_55.png.3bf68e71a95305f68df0240b39f9cad2.png

    The next step is to try this report inside the interactive viewer. Select the interactive viewer mode:

    image2014-9-1122_10_26.png.5a30bad7930a01d3d76f7bdd76e10ccb.png

    And run the report inside the interactive viewer:

    image2015-1-2710_37_23.png.64dead896df2dfe7f8937220914aaf71.png

    Deploy and test the samples on JasperReports Server

    I'm sure that at this point you would like to test the reports on the server.

    There is a step by step guide on how to configure the server on this page: JasperReports Server setup for Custom Visualization Component

    Open a report (i.e. Zoomable Circle Packing)

    Deploy it on the server by using the deploy button (the small server icon with the blue arrow)

    image2014-9-1122_31_0.png.bdccacc9a05906cf9cb9f0d503bdd0ec.png

    Select where to deploy it on the server:

    image2015-1-2711_31_21.png.93c18c5792858e7341eb9f32a5f4de2b.png

    At this point, Jaspersoft Studio will (as usual) introspect the report, looking for resources to upload. The Custom Visualization Component is not an exception: Jaspersoft Studio will look for the script and css properties to upload, as part of the report unit, the component javascript and optionally the references css file.

    image2015-1-2711_33_27.png.1e0a651d135c044561c7317dfcefa422.png

    Use as data source /datasources/JServerJNDIDS which usually points to a database with the orders table, compatible with the one used to create the samples.

    This should be the result after the publishing the new report unit:

    image2015-1-2711_36_27.png.ffa49f2225e725a446150509a12933fe.png

    Click finish and look on the server the new report, run it and you should be able to see the report running inside JasperReports Server:

    image2014-9-1122_36_35.png.f3698ae88b8167123109a4a879099c51.png

    Reference

    image2015-1-2710_19_18.png.3e6459a7a775f7a5a2e5a996744921e1.png

    image2015-1-2710_28_28.png.eb58d8a399b7312e4ff5c009c15c06dd.png

    image2015-1-2710_33_55.png.ea134c77f9ef9cee096d5c67024748c5.png

    image2015-1-2710_37_23.png.a1f0571f389ddd8b301a864796703f6d.png

    image2014-9-1122_36_35.png.a86f697a0ac99fdc946aafc97e6f4214.png

    cvc_samples_20150127.tgz


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...