Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add class diagram for Insight #144

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,38 @@ Sequence Diagram
The following sequence diagram illustrates the sequence of interactions involved in the editing of a transaction:
![](./uml/uml-images/processList.png)


### [Implemented] Insights

#### Description

This feature provides insights into the categorized expenses and incomes of the user. It utilizes the Insight
class to calculate and display pie charts representing the distribution of expenses and incomes across
different categories. <br>

#### Design and Implementation

1. The displayCategoryInsight method iterates through the list of transactions and calculates the total income
and expense amounts for each category. It then calls the displayPieChart method to visualize these insights
using pie charts.

2. The displayPieChart method creates separate pie charts for income and expense categories using the XChart
library. It customizes the appearance of the charts and adds series for each category with their respective
income or expense amounts.

3. The indexOf method is a private helper function used to find the index of a specific category within an
array
of categories.

4. The closeInsightFrames method is responsible for closing any open frames related to insights, specifically
targeting frames related to income and expense insights to ensure proper cleanup and resource management.

The following is the class diagram for Insights class

![](./uml/uml-images/insightDiagram.png)



## Product scope

### Target user profile
Expand Down
1 change: 1 addition & 0 deletions docs/team/vavinan.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ It is optimized for use via a Command Line Interface (CLI) and is written in Jav
* Developer Guide:
* Added implementation details for the feature `delete`.
* Added implementation details for the feature `edit`.
* Added implementation details for the feature `insights`.
### Feature 1 - Deleting Transaction

1. Created the `removeTransaction` method to handle deletion of a transaction based on its index in the list.
Expand Down
57 changes: 57 additions & 0 deletions docs/uml/insightDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
@startuml
skinparam classAttributeIconSize 0
hide abstract circle
hide class circle
hide enum circle
package budgetbuddy.insight {
class Insight {
+displayCategoryInsight(transactionArrayList: ArrayList<Transaction>): void
-displayPieChart(categoryArray: Category[], incomeArray: Double[], expenseArray: Double[]): void
-indexOf(array: Category[], target: Category): int
+closeInsightFrames(): void
}
}

package budgetbuddy.categories {
enum Category <<enumeration>> {
+Category(categoryNum: int, categoryName: String)
+getCategoryName(): String
+getCategoryNum(): int
}
}

package budgetbuddy.transaction.type {
abstract class Transaction{
-category: Category {dependency}
+Transaction(accountNumber: int, accountName: String,
description: String, amount: double, date: String)
+getAmount(): double
+getCategory(): Category
+setCategory(category: Category): void
<color: Red>{abstract} +getTransactionType() </color>: String
}
}

package org.knowm.xchart {
class PieChart
class PieChartBuilder
class XChartPanel
class PieStyler
}

class JFrame {
+dispose(): void
}
class JPanel

Insight ...> Category : " {dependency} "
Insight ..> Transaction: {dependency}
Transaction --> "*" Category: {association}
Insight ..> JFrame :{creates 2}
Insight ..> JPanel: {creates 2}
Insight ..> PieChart: {uses 2}
Insight ..> PieChartBuilder: {uses 2}
Insight ..> XChartPanel :{uses 2}
Insight ..> PieStyler: {uses 2}

@enduml
Binary file added docs/uml/uml-images/insightDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading