Displaying BIRT content in a web page
Displaying the visualizations and layout of a BIRT design in HTML requires JavaScript and the Actuate JSAPI. Using JSAPI enables you to embed a BIRT document or part of a BIRT document into an HTML web page.
BIRT Aviatio loads the Actuate JSAPI library from the iHub server as part of the login function. The following script is used to load the Actuate JSAPI:
$.getScript( mainAppCtrl.jsapiUrl )
.done(function( script, textStatus ) {
console.log( textStatus );
})
.fail(function( jqxhr, settings, exception ) {
console.log( textStatus );
});
When a user selects a state name, the selectState function checks to see if a JSAPI BIRT viewer is already loaded. If there is no viewer available, the initViewer function is called. This function uses the following Actuate JSAPI code to initialize the viewer:
$scope.initViewer = function (region, state) {
if ($scope.viewerInitialized) {
return;
}
var reqOps = new actuate.RequestOptions( );
reqOps.setVolumeProfile( "default volume" );
reqOps.setVolume( "default volume" );
actuate.load("viewer");
$rootScope.idleTime = new Date();
actuate.initialize(
mainAppCtrl.iportalUrl,
reqOps,
mainAppCtrl.username,
mainAppCtrl.password,
function () {
$scope.viewerInitialized = true;
$scope.reportNeedsReRun(region, state);
}
);
}
See the source code for the complete example.