O'Reilly logo

Java 9 Cookbook by Nick Samoylov, Mohamed Sanaulla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

Let's first see what it takes to create BarChart. BarChart is a two axes-based chart, where the data is plotted on two axes, namely the x axis (horizontal axis) and the y axis (vertical axis). The other two axes-based charts are area chart, bubble chart, and line chart.

In JavaFX, there are two types of axes supported:

  • javafx.scene.chart.CategoryAxis: This supports string values on the axes
  • javafx.scene.chart.NumberAxis: This supports numeric values on the axes

In our recipe, we created BarChart with CategoryAxis as the x axis, where we plot the education, and NumberAxis as the y axis, where we plot the grade, as follows:

final CategoryAxis xAxis = new CategoryAxis(); final NumberAxis yAxis = new NumberAxis(); final BarChart<String,Number> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required