package scheduler.view; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.scene.chart.PieChart; import javafx.scene.control.Slider; public class AttributesController { @FXML private PieChart attributes; @FXML private Slider timeWeight; @FXML private Slider courseWeight; @FXML private Slider proximityWeight; private double total; public void initialize() { ObservableList pieChartData = FXCollections.observableArrayList( new PieChart.Data("Time Constraints", 33), new PieChart.Data("Course Constraints", 33), new PieChart.Data("Proximity Constraints", 33)); attributes.setData(pieChartData); } public void update() { total = timeWeight.getValue() + courseWeight.getValue() + proximityWeight.getValue(); ObservableList pieChartData = FXCollections.observableArrayList( new PieChart.Data("Time Constraints", timeWeight.getValue()/total), new PieChart.Data("Course Constraints", courseWeight.getValue()/total), new PieChart.Data("Proximity Constraints", proximityWeight.getValue()/total)); attributes.setData(pieChartData); } }