Starting with version 1.2 of the SDK, JavaFX introduced built-in data visualization components, located in javafx.scene.chart, that let developers easily create charts of all sorts. The API offers support for more than half a dozen chart types. All charts, however, share a common implementation design which makes the creation of all charts a similar exercise. Below is an example of how to create a bar chart.
First we define the data in a sequence of Barchart.Series data structure:
var cats = ["Q32009", "Q32008"];
Next we add an instance of BarChart to the scene graph using the data defined above:
Once the application is executed, it produces the chart shown below: