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
- Features included
The plug-ins developed specifically to provide its functionality are the following:
Basic Functionality for Graphing
The utility of the different packages and classes that make up the plug-ins is the following:
- 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.
- BIRTComposite: Model that defines a composite where to incorporate one or more graphs.
- UpdateBIRTChartJob: Work eclipse that when running, updates a graph.
- afryca.birt.l10n: Localization messages in different languages.
- BIRTServiceContextFunction: Contextual function used to instantiate the BIRT service when its injection is requested.
- BIRTServiceProvider: BIRT Service Provider.
- 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.
- 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.
- Therefore, and taking into account points 1 and 2, we can generate graphs in two different ways:
- 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).
- For more information and examples visit the BIRT website.