About the BIRT Chart Engine API
The Chart Engine API uses the Eclipse Modeling Framework (EMF) as a structured data model. Use the classes and interfaces in the Chart Engine API to modify Chart objects within a BIRT reporting application or in a stand‑alone charting application.
The Chart Engine API includes many packages in the org.eclipse.birt.chart hierarchy. The model.* packages contain the core chart model interfaces and enumeration classes generated using EMF. The model.*.impl packages contain the core chart model implementation classes generated using EMF. All other packages are dependencies from and indirect references to the core model. There is a one-to-one correspondence between classes in the impl packages and interfaces in matching model packages. The classes in the impl packages implement the methods in the interfaces of the model classes. The impl classes also contain factory methods used to create an instance of a class.
Using the BIRT Chart Engine API
Although there are over 500 classes and interfaces in the BIRT Chart Engine API, most functionality for creating or modifying a chart is concentrated in a small subset of classes and interfaces. The primary interface in the BIRT Chart Engine API is the Chart interface. An object of the Chart type is called the chart instance object. The Chart interface has two subinterfaces, ChartWithAxes and ChartWithoutAxes. DialChart is a third interface that inherits from ChartWithoutAxes. ChartWithoutAxes defines a pie chart and DialChart defines a meter chart. ChartWithAxes defines all other chart types.
To create a chart instance object, call create( ) in ChartWithAxesImpl, ChartWithoutAxesImpl, or DialChartImp, as in the following statement:
ChartWithAxes myChart = ChartWithAxesImpl.create( );
To set the basic properties of a chart, such as its orientation and dimensionality, use setter methods of the Chart interface, such as:
myChart.setOrientation( Orientation.VERTICAL_LITERAL );
myChart.setDimension( ChartDimension.THREE_DIMENSIONAL );
Set more complex properties of a chart, like characteristics of the chart’s axes and series by getting an instance of the object to modify and then setting its properties. For example, to set an x-axis caption, use the following code:
Axis xAxis = myChart.getPrimaryBaseAxes( )[0];
xAxis.getTitle( ).getCaption( ).setValue( "Months" );
Although charts are often identified by type, such as a pie chart or a line chart, a chart with multiple series of differing types cannot be classified as one type. A series has a specific type. Use the BIRT Chart Engine API to create a specific type of series by using the create( ) method of one of the SeriesImpl subclasses. For example, the following code creates a bar series:
BarSeries barSeries1 = ( BarSeries ) BarSeriesImpl.create( );
Chart Engine API class and interface hierarchy
The diagrams that follow contain hierarchies for the following chart engine packages:
*org.eclipse.birt.chart.aggregate
*org.eclipse.birt.chart.model.attribute
*org.eclipse.birt.chart.datafeed
*org.eclipse.birt.chart.model.component
*org.eclipse.birt.chart.device
*org.eclipse.birt.chart.model.data
*org.eclipse.birt.chart.event
*org.eclipse.birt.chart.model.layout
*org.eclipse.birt.chart.exception
*org.eclipse.birt.chart.model.type
*org.eclipse.birt.chart.factory
*org.eclipse.birt.chart.render
*org.eclipse.birt.chart.log
*org.eclipse.birt.chart.script
*org.eclipse.birt.chart.model
*org.eclipse.birt.chart.util
The hierarchy diagrams for the org.eclipse.birt.chart.model.*.impl packages are not included because they are simply implementations of the interfaces in the corresponding org.eclipse.birt.chart.model.* packages. The model packages, with two exceptions, contain only interfaces.
The first exception is org.eclipse.birt.chart.model, which has one class, ScriptHandler. The second exception is org.eclipse.birt.chart.model.attribute, which has a set of enumeration classes, one for each attribute. Each of the enumeration classes contains only a list of valid values for its attribute.
chart.aggregate class and interface hierarchy
The chart.aggregate package contains the class and interface that support the aggregate functions that produce the values that a chart shows. Figure 4‑10 contains the class and interface hierarchy for org.eclipse.birt.chart.aggregate.
Figure 4‑10 Classes and interfaces in org.eclipse.birt.chart.aggregate
chart.datafeed class and interface hierarchy
The chart.datafeed package contains the class and interfaces that support defining a custom data set for a chart. Figure 4‑11 contains the class and interface hierarchy for org.eclipse.birt.chart.datafeed.
Figure 4‑11 Classes and interfaces in org.eclipse.birt.chart.datafeed
chart.device class and interface hierarchy
The chart.device package contains the classes and interfaces that support rendering a chart to a specific output type. Device adapter classes provide the rendered output. These classes process the events defined in the chart.event package. Display adapter classes provide metrics for the output device. Figure 4‑12 contains the class hierarchy for org.eclipse.birt.chart.device.
Figure 4‑12 Classes in org.eclipse.birt.chart.device
Figure 4‑12 Classes in org.eclipse.birt.chart.device
Figure 4‑13 contains the interface hierarchy for org.eclipse.birt.chart.device.
Figure 4‑13 Interfaces in org.eclipse.birt.chart.device
chart.event class and interface hierarchy
The chart.event package contains the set of events that a rendering device that extends the chart.device.DeviceAdapter class can support. It also provides structural and caching classes for events. Figure 4‑14 contains the interface hierarchy for org.eclipse.birt.chart.event.
Figure 4‑14 Interfaces in org.eclipse.birt.chart.event
Figure 4‑15 contains the class hierarchy for org.eclipse.birt.chart.event.
Figure 4‑15 Classes in org.eclipse.birt.chart.event package
Figure 4‑15 Classes in org.eclipse.birt.chart.event package
chart.exception class hierarchy
The chart.exception package contains the single exception class the BIRT Chart Engine defines. Figure 4‑16 contains the class hierarchy for org.eclipse.birt.chart.exception.
Figure 4‑16 Class in org.eclipse.birt.chart.exception
chart.factory class and interface hierarchy
The chart.factory package contains classes and interfaces that build and generate a chart. It also contains a context class that provides information about the environment in which the factory runs, such as the locale and associated localization information. Figure 4‑17 contains the class hierarchy for org.eclipse.birt.chart.factory.
Figure 4‑17 Classes in org.eclipse.birt.chart.factory
Figure 4‑18 contains the interface hierarchy for org.eclipse.birt.chart.factory.
Figure 4‑18 Interfaces in org.eclipse.birt.chart.factory
chart.log class and interface hierarchy
The chart.log package contains a single class and an interface to manage logging of the tasks that the BIRT Chart Engine performs. Figure 4‑19 contains the class hierarchy for org.eclipse.birt.chart.log.
Figure 4‑19 Class and interface in org.eclipse.birt.chart.log
chart.model interface hierarchy
The chart.model package contains the interfaces that describe the available chart types and the factory for generating charts. Figure 4‑20 contains the interface hierarchy for org.eclipse.birt.chart.model.
Figure 4‑20 Interfaces in org.eclipse.birt.chart.model
chart.model.attribute class and interface hierarchy
The chart.model.attribute package contains classes that define the permitted values for attributes as static fields. Figure 4‑21 contains the class hierarchy for org.eclipse.birt.chart.model.attribute.
Figure 4‑21 Classes in org.eclipse.birt.chart.model.attribute
Figure 4‑21 Classes in org.eclipse.birt.chart.model.attribute
The interfaces in the chart.model.attribute provide the getter and setter methods that chart engine objects use to test and set the values of the attributes. Figure 4‑22 contains the interface hierarchy for org.eclipse.birt.chart.model.attribute.
Figure 4‑22 Interfaces in org.eclipse.birt.chart.model.attribute
Figure 4‑22 Interfaces in org.eclipse.birt.chart.model.attribute
Figure 4‑22 Interfaces in org.eclipse.birt.chart.model.attribute
chart.model.component interface hierarchy
The chart.model.component package contains the interfaces that define the behavior of all the components that make up a chart. Figure 4‑23 contains the interface hierarchy for org.eclipse.birt.chart.model.component.
Figure 4‑23 Interfaces in org.eclipse.birt.chart.model.component
chart.model.data interface hierarchy
The chart.model.data package contains interfaces that define a data source, a query structure, and the data components for a chart. These interfaces define getter and setter methods for data set properties and the permitted values for these properties as static fields. Figure 4‑24 contains the interface hierarchy for org.eclipse.birt.chart.model.data.
Figure 4‑24 Interfaces in org.eclipse.birt.chart.model.data
Figure 4‑24 Interfaces in org.eclipse.birt.chart.model.data
chart.model.layout interface hierarchy
The chart.model.layout package contains the interfaces that define and arrange the blocks that make up the main components of a chart, such as the plot, title, and legend areas. Figure 4‑25 contains the interface hierarchy for org.eclipse.birt.chart.model.layout.
Figure 4‑25 Interfaces in org.eclipse.birt.chart.model.layout
chart.model.type interface hierarchy
The chart.model.type package contains the interfaces that define the series for all the available chart types. Figure 4‑26 contains the interface hierarchy for org.eclipse.birt.chart.model.type.
Figure 4‑26 Interfaces in org.eclipse.birt.chart.model.type
chart.render class and interface hierarchy
The chart.render package contains classes and interfaces that render a chart. Figure 4‑27 contains the interface hierarchy for org.eclipse.birt.chart.render.
Figure 4‑27 Interfaces in org.eclipse.birt.chart.render
Figure 4‑28 contains the class hierarchy for org.eclipse.birt.chart.render.
Figure 4‑28 Classes in org.eclipse.birt.chart.render
chart.script class and interface hierarchy
The chart.script package contains the classes and interfaces that support script handling for chart developers to write custom code within the chart class itself. Figure 4‑29 contains the class and interface hierarchy for org.eclipse.birt.chart.script.
Figure 4‑29 Classes and interfaces in org.eclipse.birt.chart.script package
chart.util class hierarchy
The chart.util package contains classes that support data types and looking up attribute and property values in the literal classes. Figure 4‑30 contains the class hierarchy for org.eclipse.birt.chart.util.
Figure 4‑30 Classes in org.eclipse.birt.chart.util