July 2017
Beginner to intermediate
715 pages
17h 3m
English
In the following example, we will demonstrate how to display the same information, but we will organize the X axis categories by year. We will use the simpleBarChartByYear method, as shown next. The axis and titles are set up in the same way as before, but with different values for the title and labels:
public void simpleBarChartByYear(Stage stage) { stage.setTitle("Bar Chart"); final BarChart<String, Number> barChart = new BarChart<>(xAxis, yAxis); barChart.setTitle("Year Summary"); xAxis.setLabel("Year"); yAxis.setLabel("Population"); ... }
The following string variables are declared for the three decades:
String year1950 = "1950"; String year1960 = "1960"; String year1970 = "1970";
The data series ...
Read now
Unlock full access