The Pentaho platform supports a number of different charts through two platform charting components, one that wraps the JFreeChart engine (ChartComponent) and one that wraps the Open Flash Charts engine (OpenFlashChartComponent).
|Report Charts and Analysis Charts Do Not Follow This Reference!|
There are 5 different places that you may specify a chart in your Pentaho solution. Only three of them follow this reference: dashboard charts, portal charts, and action sequence charts. To get details about report charts or analysis charts, follow their respective links.
Pentaho charts deliver a different output depending on the type of solution you are building. For example, an action sequence chart can be delivered via an HTML snippet or image URL, with or without a drill-through map. Dashboard charts are streamed directly to HTML after being processed using a template and an XSL stylesheet.
The good news is that in the case of dashboarding, portal charts and action sequence charts, they all share a common definition language. The chart definition is described in XML, and instructs the chart engine on what kind of chart you want to build and what you want it to look like. In most cases, you save the chart definition XML to a file and reference that file in your solution (with some exceptions where the definition can be processed in-line). This reference documents the format of the chart definition XML file.
In the simplest of charts, you can hand over a standard two dimensional dataset and the chart engine will do its best to plot the data you've given. However, there are several supported charts that have specific guidelines for the format and type of data they are expecting. The chart definition file does very little (in many cases, nothing at all) to ensure that the data you've passed is renderable by the type of chart you have specified. This leads to great frustration when you believe you have the chart definition correct, yet the chart doesn't render.
In the PentahoDoc:Supported Chart Types section of this reference, we've documented the type of dataset that each chart type is expecting. This should help alleviate some of the frustration associated with rendering some of the more advanced charts.
Invariably, each of our methods of rendering charts retrieve data input differently.
For action sequences, the chart data is built in a previous action step and handed to the chart action as an input parameter.
For dashboards and portlet charts, the chart definition supports the embedded <data> element, which allows the user to define necessary parameters to an action sequence that will generate the dataset, then hand it to the dashboard or portlet chart.
Here is an example of the <data> element:
Every chart definition starts with a top level chart element. For each property that you want to include in your chart, there is a corresponding XML element. These elements are nested inside the chart element.
|"What About the Element??"|
The <chart-attributes> element is supported as the root level node of action sequence charts, and by default, is the element that the Design Studio will generate (and expects) when building a chart definition in-line in an action sequence. This dual support is not carried over to dashboard or portal charts however.
The rule of thumb, until we have some deprecations and backward-compatability support, is to use the <chart> root element whenever you are defining your chart in an external file, and to leave the <chart-attributes> element in place in the action sequence.
Here is a first sample of a Pentaho chart definition. Don't worry too much about the individual elements just yet, they are described in more detail in the Chart Properties Reference.
The one element that is required for all charts is the chart-type element. At the very least, you need to tell the chart engine what type of chart to build. The Chart Properties Reference lists the valid list of values for the chart-type element.
Below is a list of the charts that are currently supported. Follow the link to see what type of data each chart expects, and the elements that are required in order to build a specific type of chart.
- Line Chart
- Area Chart
- Bar Chart
- Pie Chart
- PieGrid Chart (or Multiple Pies)
- Dial Chart
- Dial Grid Chart
- Bar-Line Combination Chart
- XY Line Chart
- XY Area Chart
- XY Step Chart
- XY StepArea Chart
- XY Difference Chart
- XY Dot Chart
- Time Series Line Chart
- Time Series Area Chart
- Time Series Step Chart
- Time Series StepArea Chart
- Time Series Dot Chart
- Bubble Chart
Page: Bar Chart
Page: Bar-Line Combination Chart
Page: Bubble Chart
Page: Chart Properties Reference
Page: Dial Chart
Page: Dial Grid Chart
Page: Flash Area Chart
Page: Flash Bar Chart
Page: Flash Bar-line Combination Chart
Page: Flash Bubble Chart
Page: Flash Line Chart
Page: Flash Pie Chart
Page: Flash XY Dot Chart
Page: Line Chart
Page: Pie Chart
Page: PieGrid Chart (or Multiple Pies)
Page: The Categorical Dataset
Page: The Time Series Dataset
Page: The XY Dataset
Page: The XYZ Dataset
Page: Time Series Area Chart
Page: Time Series Dot Chart
Page: Time Series Line Chart
Page: Time Series StepArea Chart
Page: Time Series Step Chart
Page: XY Area Chart
Page: XY Difference Chart
Page: XY Dot Chart
Page: XY Line Chart
Page: XY StepArea Chart
Page: XY Step Chart