ChartBeans and the BI Platform

Pentaho Chartbeans is the new architecture for rendering charts as of the Citrus (3.5) release of the Pentaho BI Platform.

Initializing Chart Plugin Options

Pentaho Chartbeans is capable of rendering charts from multiple chart engines. These engines are wrapped and instanced from the ChartFactory in Chartbeans. The initialization of the ChartFactory with the chart engines (called plugins in the chart code) inside the BI Platform happens on system startup through a system listener (the org.pentaho.platform.plugin.action.chartbeans.ChartBeansSystemListener class).

The ChartBeansSystemListener will look to the chartbeans_config.xml configuration file (in <solutions>system/chartbeans directory) for a series of beans that identify the plugin classes to load and hand over to the ChartFactory. The entries look similar to the example below:

<beanConfig>
		<bean id="FlashChartEngine" class="org.pentaho.chart.plugin.openflashchart.OpenFlashChartPlugin"/>
		<bean id="JFreeChartEngine" class="org.pentaho.chart.plugin.jfreechart.JFreeChartPlugin"/>
	</beanConfig>

The example code above loads the two default chart plugins that exist in the platform today - the Flash chart plugin and the JFreeChart chart plugin.

The bean id attribute ties these chart plugins into the platform's plugin layer (the external plugin system that allows code to be deployed to the solution directory; not to be confused with chart plugins). If you would like to extend the existing chart plugins, you can create a platform plugin that extends an existing chart plugin, and the ChartBeansSystemListener will find and load your extension as an override to the default system plugins. You only need to specify your subclass as a bean in your platform plugin, with the same bean id as is listed in the chartbeans configuration file. So, in our example configuration above, I could override the JFreeChartPlugin with my subclassed MyJFreeChartPlugin by listing the following bean in my platform plugin's plugin.xml file:

<bean id="JFreeChartEngine" class="org.blah.charts.MyJFreeChartPlugin"/>

For more information on platform plugin development, read here.