diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 9e81f82d61..aea8b16f3d 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -31,7 +31,7 @@ ## Acknowledgements **Xchart (A Simple Charting Library for Java)** -- author: KNOWN +- author: KNOWM - source: [https://knowm.org/open-source/xchart/](https://knowm.org/open-source/xchart/) **JSON Simple (simple Java toolkit for encoding and decoding JSON)** @@ -125,6 +125,13 @@ VisCommand's Role: 3) Calls the Visualizer to display the chart to the user +As with other Commands in our Financial Planner application, the constructor of VisCommand +takes RawCommand as parameter. The RawCommand would provide the arguments (chart type and cashflow type) +for the VisCommand provided. + +The VisCommand also inherits from the abstract Command class which would provide the execute() abstract method +that would be called in main() + Categorizer's Role: According to the cashflow type (Income/Expense) arugment passed in, the Categorizer sorts the @@ -145,11 +152,11 @@ Overall ![](images/vis/visualisationSequence.png) -Categorizer +Categorizer (`sort cashflow entries` ref from overall sequence diagram above) ![](images/vis/categorizerSequence.png) -Visualizer +Visualizer (`displaying chart` ref from overall sequence diagram above) ![](images/vis/visualizerSequence.png) diff --git a/docs/diagrams/vis/categorizerSequence.puml b/docs/diagrams/vis/categorizerSequence.puml index 795fd59a71..f413138d0e 100644 --- a/docs/diagrams/vis/categorizerSequence.puml +++ b/docs/diagrams/vis/categorizerSequence.puml @@ -9,10 +9,10 @@ participant "<>\nCategorizer" ":VisCommand"-> "<>\nCategorizer": Categorizer.sortType(cashflowList, type) -alt type == "expense" +alt "expense" "<>\nCategorizer" -> "<>\nCategorizer": sortExpenses(cashflowList) return -else type == "income" +else "income" "<>\nCategorizer" -> "<>\nCategorizer": sortIncome(cashflowList) return end diff --git a/docs/diagrams/vis/visualisationClass.puml b/docs/diagrams/vis/visualisationClass.puml index 737d5d423b..cea4a2f36c 100644 --- a/docs/diagrams/vis/visualisationClass.puml +++ b/docs/diagrams/vis/visualisationClass.puml @@ -3,14 +3,9 @@ skinparam classFontColor automatic - -class "{abstract}\nCommand" #MintCream { -+execute() {abstract} -} - class VisCommand #MistyRose { --String type --String chart +-type: String +-chart: String +execute() } @@ -33,9 +28,13 @@ class Visualizer #Beige { + displayRadarChart (cashflowByCat: HashMap, type: String) } +class "{abstract}\nCommand" #MintCream { ++execute() {abstract} +} + "{abstract}\nCommand" <|-- VisCommand RawCommand <.. VisCommand -Categorizer <.. Visualizer +Categorizer <.. VisCommand Visualizer <.. VisCommand hide Circle diff --git a/docs/diagrams/vis/visualisationSequence.puml b/docs/diagrams/vis/visualisationSequence.puml index c09a083995..df3fce1c41 100644 --- a/docs/diagrams/vis/visualisationSequence.puml +++ b/docs/diagrams/vis/visualisationSequence.puml @@ -5,15 +5,15 @@ participant ":Ui" participant "<>\nCategorizer" participant "<>\nVisualizer" -":VisCommand"-> ":Ui": printDisplayChart(type) +":VisCommand"-> ":Ui": printDisplayChartMessages(type) ref over "<>\nCategorizer", ":VisCommand" : sort cashflow entries -alt #Pink cashflowbyType.empty() +alt #Pink cashflowbyType is empty ":VisCommand" -> ":Ui" : ui.printEmptyCashflow(type) -else #LightBlue !cashflowbyType.empty() +else #LightBlue cashflowbyType is not empty ref over "<>\nVisualizer", ":VisCommand": displaying chart diff --git a/docs/diagrams/vis/visualizerSequence.puml b/docs/diagrams/vis/visualizerSequence.puml index 2289204e61..35dafb8d74 100644 --- a/docs/diagrams/vis/visualizerSequence.puml +++ b/docs/diagrams/vis/visualizerSequence.puml @@ -9,14 +9,16 @@ participant "<>\nVisualizer" activate "<>\nVisualizer" -alt chart == "pie" +alt "pie" "<>\nVisualizer" -> "<>\nVisualizer": displayPieChart(cashflowList, type) -else chart == "bar" +else "bar" "<>\nVisualizer" -> "<>\nVisualizer": displayBarChart(cashflowList, type) -else chart == "radar" +else "radar" "<>\nVisualizer" -> "<>\nVisualizer": displayRadarChart(cashflowList, type) end +return + hide footbox @enduml \ No newline at end of file diff --git a/docs/images/vis/categorizerSequence.png b/docs/images/vis/categorizerSequence.png index 373fedbf3d..2efd8f7a7a 100644 Binary files a/docs/images/vis/categorizerSequence.png and b/docs/images/vis/categorizerSequence.png differ diff --git a/docs/images/vis/visualisationClass.png b/docs/images/vis/visualisationClass.png index 9f2faa4b6a..ad6224effc 100644 Binary files a/docs/images/vis/visualisationClass.png and b/docs/images/vis/visualisationClass.png differ diff --git a/docs/images/vis/visualisationSequence.png b/docs/images/vis/visualisationSequence.png index 46c620a688..4768b5af0f 100644 Binary files a/docs/images/vis/visualisationSequence.png and b/docs/images/vis/visualisationSequence.png differ diff --git a/docs/images/vis/visualizerSequence.png b/docs/images/vis/visualizerSequence.png index 11d05c66a3..9ccf49a0d2 100644 Binary files a/docs/images/vis/visualizerSequence.png and b/docs/images/vis/visualizerSequence.png differ diff --git a/src/main/java/seedu/financialplanner/commands/VisCommand.java b/src/main/java/seedu/financialplanner/commands/VisCommand.java index d02c1dfab0..63a30efa95 100644 --- a/src/main/java/seedu/financialplanner/commands/VisCommand.java +++ b/src/main/java/seedu/financialplanner/commands/VisCommand.java @@ -47,7 +47,7 @@ public void execute() throws FinancialPlannerException { ui.printEmptyCashFlow(type); return; } - ui.printDisplayChart(type, chart); + ui.printDisplayChartMessage(type, chart); Visualizer.displayChart(chart, cashflowByType, type); } } diff --git a/src/main/java/seedu/financialplanner/utils/Ui.java b/src/main/java/seedu/financialplanner/utils/Ui.java index 57c9435f8b..fa8d8dcf0e 100644 --- a/src/main/java/seedu/financialplanner/utils/Ui.java +++ b/src/main/java/seedu/financialplanner/utils/Ui.java @@ -167,7 +167,7 @@ public void printResetBudget() { showMessage("Budget has been reset to " + Budget.getInitialBudgetString() + "."); } - public void printDisplayChart(String type, String chart) { + public void printDisplayChartMessage(String type, String chart) { showMessage("Displaying " + chart + "chart for " + type); }