AFRYCA 3 allows the visualization of data using graphics of various types. For the generation of such graphs, BIRT (Business Intelligence and Reporting tools) has been used, an open source software project that provides multiple functionalities in terms of data visualization and reporting, which can be integrated into RCP applications and Web, especially in those based on Java and Java EE. The project is supported by Actuate along with contributions from IBM and Innovent Solutions.

In AFRYCA 3, there is a close relationship between BIRT and the ASE scripting environment, since it uses scripts executed by the environment that allow the developer to generate their own graphics and design them to their liking, and even decide which graphics they want to display In the application and which not.


The functionality is provided from the following features:


Plug-ins for BIRT operation

  • Plugins included
    • afryca.birt
    • javax.el
    • javax.servlet.jsp
    • org.apache.commons.logging
    • org.apache.derby
    • org.apache.jasper.glassfish
    • org.eclipse.core.filebuffers
    • org.eclipse.core.filesystem
    • org.eclipse.core.resources
    • org.eclipse.datatools.connectivity.apache.derby
    • org.eclipse.datatools.connectivity.sqm.core
    • org.eclipse.datatools.connectivity.ui
    • org.eclipse.datatools.modelbase.dbdefinition
    • org.eclipse.datatools.modelbase.derby
    • org.eclipse.datatools.modelbase.sql
    • org.eclipse.datatools.modelbase.sql.edit
    • org.eclipse.datatools.modelbase.sql.query
    • org.eclipse.datatools.modelbase.sql.query.edit
    • org.eclipse.datatools.modelbase.sql.xml.query
    • org.eclipse.draw2d
    • org.eclipse.emf.ecore.edit
    • org.eclipse.equinox.http.registry
    • org.eclipse.equinox.jsp.jasper
    • org.eclipse.equinox.jsp.jasper.registry
    • org.eclipse.gef
    • org.eclipse.jetty.deploy
    • org.eclipse.jetty.osgi.boot
    • org.eclipse.jetty.webapp
    • org.eclipse.jetty.xml
    • org.eclipse.ltk.core.refactoring
    • org.eclipse.text
    • org.eclipse.ui.forms
    • org.eclipse.ui.navigator
    • org.eclipse.ui.views
  • Features included
    • org.eclipse.birt.chart.osgi.runtime
    • org.eclipse.birt.engine.runtime
    • org.eclipse.birt.osgi.runtime
    • org.eclipse.datatools.connectivity.oda.feature
    • org.eclipse.datatools.enablement.oda.feature


The plug-ins developed specifically to provide its functionality are the following:


Basic Functionality for Graphing

  • Outbuildings
    • afryca.ase
    • org.eclipse.birt.core
    • org.eclipse.birt.chart.engine
    • org.eclipse.birt.chart.engine.extension
    • org.eclipse.core.runtime
    • org.eclipse.e4.ui.di
    • org.eclipse.e4.core.contexts
    • org.eclipse.e4.ui.workbench
    • org.eclipse.e4.ui.model.workbench
    • org.eclipse.ui


The utility of the different packages and classes that make up the plug-ins is the following:


  • afryca.birt.builder
    • AbstractChartBuilder: Abstract class for building graphics.
    • AbstractChartWithAxisBuilder: Abstract class for building graphics with axes.
    • AreaChartBuilder: Area graphics builder.
    • BarChartBuilder: Bar chart builder.
    • LineChartBuilder: Constructor of graphs of lines.
    • PieChartBuilder: Constructor of pie charts.
    • BIRTCompositeBuilder: Constructor of a BIRTComposite object.
    • ChartCanvas: Constructor of a canvas object where to paint a graphic.
  • afryca.birt.composite
    • BIRTComposite: Model that defines a composite where to incorporate one or more graphs.
  • afryca.birt.composite.job
    • UpdateBIRTChartJob: Work eclipse that when running, updates a graph.
  • afryca.birt.l10n: Localization messages in different languages.
  • afryca.birt.provider
    • BIRTServiceContextFunction: Contextual function used to instantiate the BIRT service when its injection is requested.
    • BIRTServiceProvider: BIRT Service Provider.
  • afryca.birt.service
    • IBIRTService: BIRT service interface.


The afryca.birt plug-in defines an OSGi declarative service for rendering graphics. The service is defined in the OSGI-INF / birt_service_context_function.xml file and uses an eclipse contextual function, which performs an instantiation of the class afryca.birt.service.provider.BIRTServiceContextFunction when requesting the injection of the service whose interface defines afryca.birt.service.IBIRTService.

  • Service Interface:
    • createBIRTCompositeBuilder() : BIRTCompositeBuilder // Creating a BIRTCompositeBuilder Instance
    • createReport(String) // Creating a report.
    • setInitialPropertiesReport(String, String, String, String) // Assigning different basic properties to a report.
    • setPropertyReport(String, String) // Assign a property to a report.
    • createMasterPage(String) // Creating a Master Page.
    • setPropertyMasterPage(Integer, String, String) // Assigning a Property to a Master Page.
    • createScriptDataSource(String) //Creating a ScriptDataSource object.
    • setPropertyDataSource(Integer, String, String) // Assigning a property to a data source script.
    • createScriptDataSet(String) // Creating a ScriptDataSet object.
    • setOpenScriptDataset(String) //Assignment of the code to be executed when the dataset is opened.
    • setFetchCodeScriptDataset(String) // Allocation of the code to be executed when traversing the data stored in the dataset.
    • setOutputColumnCategorySeries(String) // Create a data column that defines a category in a chart.
    • setOutputColumnSeries(String) // Creating a data column.
    • setResultsColumn(String, String, Integer) // Creation of a final data column.
    • createAreaChartInReport(String, String, String, String, String) // Creating an area chart in a report using a ScriptDataset.
    • createAreaChart(String, String, String, String[], Double[]) // Create an area chart using a predefined data set.
    • createBarChartInReport(String, String, String, String, String) // Creating a bar chart in a report using a ScriptDataset.
    • createBarChart(String, String, String, String[], Double[]) // Creating a bar chart using a predefined data set.
    • createLineChartInReport(String, String, String, String, String) // Creating a line chart in a report using a ScriptDataset.
    • createLineChart(String, String, String, String[], Double[]) // Creating a line chart using a predefined data set.
    • createPieChartInReport(String, String, String) // Creating a pie chart in a report using a ScriptDataset.
    • createPieChart(String, String[], Double[]) // Creating a pie chart using a predefined data set.
    • updateDataset(String[], Double[], Composite) // Updating the predefined data set of a chart.
    • createOutputHTMLChart(ClassLoader): ByteArrayOutputStream // Display graphic using an HTML render.
    • saveAsReport() // Save report.
    • shutdown() // Turn off the BIRT engine.
    • createCanvas(Composite, Integer) // Create canvas to draw the graphic.
    • disposeCanvas(Composite) // Delete canvas.

Final notes

  1. In order to be able to represent a graph in AFRYCA, it is essential to use the BIRTCompositeBuilder class. This class provides us with the functionality to create composites to visualize the graphics, for it is necessary to use the service BIRT, specifically the function createBIRTCompositeBuilder (). This function, through dependency injection, gets an instance of the BIRTCompositeBuilder class and injects it into a specific context. Once the instance is created and assigned to a context, we must assign different attributes that the class possesses through the following functions:
    • setModule(String): Assigns the module defined in ASE for the creation of graphs.
    • setNode(String): Assigns the preference node.
    • setKey(String): Assigns the preference key where the functions used by ASE for the creation of the graphics are included.
    • setParent(Composite): Assign the composite where we want to visualize the graph.
    • setStyle(Integer): Assigns the composite style.
    • build(): Creates a BIRTComposite.
  2. The BIRT service provides the functionality of generating graphs from different datasets. The data of a graph can be generated by defining categories and series from an array of type String and Double respectively, and assign them to the graphs using the createXChart functions. In addition, graphs can be generated within a report or report, but in this case, data is provided by a ScriptDataSet object, which is generated by the createScriptDataSet (String) function. This object allows you to create a dataset from a script in JavaScript language, which can be defined using a String variable that includes the code that we want to execute in according to what situations. The service gives us the option of executing JavaScript code when the ScriptDataSet is opened (reading the data) through the setOpenScriptDataSet (String) function and also when scrolling through the data setFetchCodeScriptDataSet (String).
  3. Therefore, and taking into account points 1 and 2, we can generate graphs in two different ways:
    1. Composite graph and dataset defined by definition of categories and series: To do this, only use the function corresponding to the type of graph that we want to show createXChart. Then we only have to create the canvas where we are going to visualize the graph, which will be included in the composite referenced in step 1, for this we use the function createCanvas(Composite, Integer).
    2. Graph in report and dataset defined by a ScriptDataSet object: The first thing to do is to use the function createReport(String) to create the report in the path that we indicate, once created, we can assign different basic properties such as title, description, etc. , Using the setInitialPropertiesReport(String, String, String, String) function. The next step is to create a Master Page within the report using the createMasterPage(String) function, to which we can also assign properties via the setPropertyMasterPage(Integer, String, String) function. Once this is done, we must create a ScriptDataSource object, which establishes a link between the report and the ScriptDataSet, using the createScriptDataSource(String) function. The next step is to define the dataset script as indicated in point 2 and, once created, define the different categories and series using the setOutputColumnCategorySeries(String) and setOutputColumnSeries(String) functions. Note that the names we assign to these columns must match the ones we have defined in the JavaScript code for reading dataset data through the setOpenScriptDataSet(String) function. To define the type of chart that we want to create, we have to make use of the functions of type createXChartInReport. Finally, save the report created by the function saveAsReport() and release the BIRT engine using shutdown().
  4. For more information and examples visit the BIRT website.