Java Reference
In-Depth Information
Chapter 8
Creating Charts in JavaFX
Any sufficiently advanced technology is indistinguishable from magic.
—Arthur C. Clarke
Reporting is an important aspect in many business applications. The JavaFX Platform contains an API for
creating charts. Because a Chart is basically a Node , integrating charts with other parts of a JavaFX application is
straightforward. As a consequence, reporting is an integral part of the typical JavaFX Business Application.
Designing an API is often a compromise among a number of requirements. Two of the most common
requirements are “make it easy” and “make it easy to extend.” The JavaFX Chart API fulfills both of these. The Chart
API contains a number of methods that allow developers to change the look and feel as well as the data of the chart,
making it a flexible API that can be easily extended. The default values for the settings are very reasonable, though,
and make it easy to integrate a chart with a custom application, with only a few lines of code.
The JavaFX Chart API in JavaFX 8 has eight concrete implementations that are ready to be used by developers.
Apart from those, developers can add their own implementations by extending one of the abstract classes.
Structure of the JavaFX Chart API
Different types of charts exist, and there are a number of ways to categorize them. The JavaFX Chart API distinguishes
between two-axis charts and charts without an axis. The JavaFX 8 release contains one implementation of a no-axis
chart, which is the PieChart . There are a number of two-axis charts, which all extend the abstract class XYChart , as
shown in Figure 8-1 .
 
Search WWH ::




Custom Search