Gallery Overview

In many scenarios, developers require their charting applications to include a variety of different chart types when displaying data. Depending on the type of data they are graphically displaying the best chart type could vary. Chart FX recognizes this and provides one of the most complete libraries of chart types available. These chart types may be set using the setGallery method of the Chart and Series objects.

The following chart galleries are supported by the core Chart FX component: Area, Bar, Bubble, CandleStick, Contour, Cube, Curve, CurveArea, Doughnut, Gantt, HiLowClose, Lines, OpenHiLowClose, Pareto, Pie, Pyramid, Radar, Scatter, Step and Surface.

By default, Chart FX will produce a Bar chart populated with random data. When a developer passes a data to the chart using either the API or a supported data provider, the values plotted will represent the values passed. The ability to change the gallery is available to end users through the context menus and toolbars, however, this feature is not available when generating images, it is only available for Active Charts.

Developers can modify the gallery using either the design time property dialog of their development environment or programmatically using the Gallery property. To set the chart to a Pie chart, the following code may be used:


// Set the Gallery to Pie Globally
chart1.setGallery(Gallery.PIE);

Combination Charts

Not only does Chart FX for Java support a myriad of galleries, but they may also be used in combination by employing the Gallery property of the Series object. Applying this property to a specific series will create a multiple type chart, where different Chart Types can be combined in the same chart. For example, if you initially created a bar chart with 3 series, you can convert the first series to a line chart as follows:


// Set the 1st Series to the Line Gallery
chart1.getSeries(0).setGallery(Gallery.LINES);

You must be careful of the galleries selected to combine, as not all combinations will produce desirable results. For example, combining a chart that does not have numerical axis (e.g. Pie Chart) with a chart that has a numerical axis (e.g. Line Chart) will produce a chart that can't be read by the end user.

A rule of thumb is that you can combine axis charts with similar types and non-axis charts with similar types, as follows:

  • Axis Charts: Lines, Bar, Curve, Scatter, Area, Step, HiLowClose, Cube, Bubble, CandleStick, CurveArea.
  • Non-axis charts: Pie, Radar, Polar, Doughnut, Pyramid.
  • Note: Gantt, Surface and Contour can't be combined with other chart types.

Another important issue to keep in mind when creating combination charts is the number of series each chart type requires to properly plot the data. For example, an Open-Hi-Lo-Close chart requires 4 consecutive series to properly plot the data, so if you want to combine this chart type with a line chart, the series containing the data for the line chart must be either the first or the last series in the data set.

The GalleryObj

The GalleryObj object is used to apply additional properties to selected galleries. For example, when you obtain the GalleryObj of a Pie chart, you can set shadows, configure exploding pie slices, etc. The use of additional galleryobj classes is a feature supported by many but not all gallery types. Please see the GalleryObj class in the Chart FX for Java API for all the supported chart types.