Skip to content

Commit

Permalink
Merge pull request #150 from wwweert123/VisDG
Browse files Browse the repository at this point in the history
Fix DG sequence diagram for cat and vis
  • Loading branch information
wwweert123 authored Nov 3, 2023
2 parents 3f4327a + d95af1b commit ad69fe0
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 21 deletions.
13 changes: 10 additions & 3 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)**
Expand Down Expand Up @@ -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
Expand All @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions docs/diagrams/vis/categorizerSequence.puml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ participant "<<class>>\nCategorizer"

":VisCommand"-> "<<class>>\nCategorizer": Categorizer.sortType(cashflowList, type)

alt type == "expense"
alt "expense"
"<<class>>\nCategorizer" -> "<<class>>\nCategorizer": sortExpenses(cashflowList)
return
else type == "income"
else "income"
"<<class>>\nCategorizer" -> "<<class>>\nCategorizer": sortIncome(cashflowList)
return
end
Expand Down
15 changes: 7 additions & 8 deletions docs/diagrams/vis/visualisationClass.puml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand All @@ -33,9 +28,13 @@ class Visualizer #Beige {
+ <u>displayRadarChart (cashflowByCat: HashMap, type: String)
}

class "{abstract}\nCommand" #MintCream {
+execute() {abstract}
}

"{abstract}\nCommand" <|-- VisCommand
RawCommand <.. VisCommand
Categorizer <.. Visualizer
Categorizer <.. VisCommand
Visualizer <.. VisCommand

hide Circle
Expand Down
6 changes: 3 additions & 3 deletions docs/diagrams/vis/visualisationSequence.puml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ participant ":Ui"
participant "<<class>>\nCategorizer"
participant "<<class>>\nVisualizer"

":VisCommand"-> ":Ui": printDisplayChart(type)
":VisCommand"-> ":Ui": printDisplayChartMessages(type)

ref over "<<class>>\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 "<<class>>\nVisualizer", ":VisCommand": displaying chart

Expand Down
8 changes: 5 additions & 3 deletions docs/diagrams/vis/visualizerSequence.puml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ participant "<<class>>\nVisualizer"

activate "<<class>>\nVisualizer"

alt chart == "pie"
alt "pie"
"<<class>>\nVisualizer" -> "<<class>>\nVisualizer": displayPieChart(cashflowList, type)
else chart == "bar"
else "bar"
"<<class>>\nVisualizer" -> "<<class>>\nVisualizer": displayBarChart(cashflowList, type)
else chart == "radar"
else "radar"
"<<class>>\nVisualizer" -> "<<class>>\nVisualizer": displayRadarChart(cashflowList, type)
end

return

hide footbox

@enduml
Binary file modified docs/images/vis/categorizerSequence.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/vis/visualisationClass.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/vis/visualisationSequence.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/vis/visualizerSequence.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
2 changes: 1 addition & 1 deletion src/main/java/seedu/financialplanner/utils/Ui.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit ad69fe0

Please sign in to comment.