Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public BarChart getGenreAndMinutesChart(){
- final CategoryAxis xAxis = new CategoryAxis();
- xAxis.setLabel("Genre");
- xAxis.setAnimated(false);
- final NumberAxis yAxis = new NumberAxis();
- yAxis.setLabel("Minutes");
- yAxis.setAnimated(false);
- BarChart<String, Number> barChart = new BarChart<>(xAxis,yAxis);
- barChart.setAnimated(false);
- XYChart.Series<String, Number> series = new XYChart.Series();
- series.setName("Minutes played");
- for(String genre: getGenres()){
- series.getData().add(new XYChart.Data<String, Number>(genre, getHoursByGenre(genre)));
- }
- barChart.getData().add(series);
- return barChart;
- }
Add Comment
Please, Sign In to add comment