forked from nus-cs2103-AY2324S2/tp
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from marcus-ny/branch-add-analytics-gui
Implement Analytics GUI (Tab switching)
- Loading branch information
Showing
14 changed files
with
247 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package seedu.address.ui; | ||
|
||
import javafx.beans.property.ObjectProperty; | ||
import javafx.collections.FXCollections; | ||
import javafx.collections.ObservableList; | ||
import javafx.fxml.FXML; | ||
import javafx.scene.chart.PieChart; | ||
import javafx.scene.layout.Region; | ||
import seedu.address.model.person.Analytics; | ||
|
||
/** | ||
* Panel containing the analytics of the loan records. | ||
*/ | ||
public class AnalyticsPanel extends UiPart<Region> { | ||
private static final String FXML = "AnalyticsPanel.fxml"; | ||
|
||
@FXML | ||
private PieChart pieChart; | ||
|
||
/** | ||
* Creates a {@code AnalyticsPanel} with the given {@code ObjectProperty}. | ||
*/ | ||
public AnalyticsPanel(ObjectProperty<Analytics> analytics) { | ||
super(FXML); | ||
pieChart.setData(FXCollections.observableArrayList()); | ||
analytics.addListener((observable, oldValue, newValue) -> { | ||
updateChart(newValue); | ||
}); | ||
} | ||
|
||
private void updateChart(Analytics analytics) { | ||
ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList( | ||
new PieChart.Data("Active Loans", analytics.getNumActiveLoans()), | ||
new PieChart.Data("Overdue Loans", analytics.getNumOverdueLoans()) | ||
); | ||
pieChart.setData(pieChartData); | ||
} | ||
} |
Oops, something went wrong.