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> ...