The Data Analyzer portion of the Actuate JavaScript API is a set of JavaScript classes that modify, analyze, and display data within cross tab elements. These classes are available to users of BIRT iServer. The Actuate JavaScript API functions that are described in this chapter invoke and control the Data Analyzer viewer and elements that are associated with the viewer. The Data Analyzer JavaScript can be placed within a web page or any other location where the Actuate JavaScript API interfaces with a cross tab.
Load the XTabAnalyzer and dialog components to prepare the actuate.XTabAnalyzer component for use within a web page. Call actuate.XTabAnalyzer functions to create and prepare an analytics cross tab. Call the XTabAnalyzer’s submit( ) function to display an existing cross tab in a specified HTML <div> element on a web page.
In this example, cTab is the name value for the <div> element that holds the cross tab content. The web page body must contain a <div> element with an ID value of cTab, as shown in the following code:
The example code loads a report document that consists of a single data cube and cross tab. The report document can be loaded into the Data Analyzer viewer directly. This sample report document installs with iServer.
To access a cross tab element that is part of a larger report, use the cross tab element’s bookmark after setting the report name. A bookmark is set in a report designer or by an external function. Retrieve a cross tab element with actuate.xtabanalyzer.PageContent.getCrosstabByBookmark( ). For example, the following code retrieves a cross tab with the bookmark SampleRevenue:
The code in this example retrieves the current page content and the cross tab element within that page, returning an actuate.xtabanalyzer.Crosstab object. This cross-tab object supports the modification of the cross tab with the functions in the Xtabanalyzer subclasses.
To set the bookmark for a cross tab element, create a bookmark for the element within BIRT Designer Professional or call setXTabBookmark( ), as shown in the following code:
The XTabAnalyzer.submit( ) function triggers an AJAX request to display the report with all the asynchronous operations that previous viewer functions have prepared. Call submit( ) as shown in the following code:
Upon executing submit( ), the Actuate web application returns the report with the cross tab in the assigned <div> element.