Jump to content
Changes to the Jaspersoft community edition download ×
  • This documentation is an older version of JasperReports Server Visualize.js Guide. View the latest documentation.

    The JavaScript API exposed through Visualize.js allows you to embed and programmatically interact with reports dynamically. With Visualize.js, you can create web pages and web applications that seamlessly embed reports and complex interaction. You can control the look and feel of all elements through CSS and invent new ways to merge data into your application. Visualize.js helps you make advanced business intelligence available to your users.

    This chapter contains the following sections:

    Requesting the Visualize.js Script
    Contents of the Visualize.js Script
    Usage Patterns

    Each function of Visualize.js is then described in the following chapters:

    API Reference - login and logout
    API Reference - resourcesSearch
    API Reference - report
    API Reference - inputControls

    The last chapters demonstrate more advanced usage of Visualize.js:

    API Usage - Report Events
    API Usage - Report Hyperlinks
    API Usage - Interactive Reports
    Visualize.js Tools

    Requesting the Visualize.js Script

    The script to include on your HTML page is named visualize.js. It is located on your running instance of JasperReports Server. Later on your page, you also need a container element to display the report from the script.

    The content of visualize.js is type='text/javascript', but that is the default so you usually don't need to include it.

    You can specify several parameters when requesting the script:

    Parameter Type Description
    userLocale locale string Specify the locale to use for display and running reports. It must be one of the locales supported by JasperReports Server. The default is the locale configured on the server.
    logEnabled true|false Enable or disable logging. By default, it is enabled (true).
    logLevel debug|info|warn|error Set the logging level. By default the level is error.
    baseUrl URL The URL of the JasperReports Server that will respond to visualize requests. By default, it is the same server instance that provides the script.
    _opt true|false When true, the Javascript is optimized (reduced in size). By default, this parameter is false.

    The following request shows how to use script parameters:

    <script src="http://bi.example.com:8080/jasperserver-pro/client/             visualize.js?userLocale=fr&logLevel=debug"></script>[/code]                    

    Contents of the Visualize.js Script

    The Visualize.js script itself is a factory function for an internal JrsClient.

    You write JavaScript in a callback that controls what the client does. The following code sample shows the functions of the JrsClient that are available to you:

    These functions are described in the remaining API reference chapters.

    Usage Patterns

    After specifying the authentication information, you write the callback that will execute inside the client provided by visualize.js.

    If you prefer, you can use the deferred pattern instead of the callback:


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...