diff --git a/app/src/main/java/com/example/bondoyap/ui/graph/GraphFragment.kt b/app/src/main/java/com/example/bondoyap/ui/graph/GraphFragment.kt
index b9d913d30e715cea93fef5765bf2b7e99ae472b7..cec599938bae4f26cc961e1b11f7d2623883cf55 100644
--- a/app/src/main/java/com/example/bondoyap/ui/graph/GraphFragment.kt
+++ b/app/src/main/java/com/example/bondoyap/ui/graph/GraphFragment.kt
@@ -9,7 +9,11 @@ import android.view.View
 import android.view.ViewGroup
 import android.widget.TextView
 import androidx.core.content.ContextCompat
+import androidx.lifecycle.Observer
 import com.example.bondoyap.R
+import com.example.bondoyap.ui.transactions.TransactionsApplication
+import com.example.bondoyap.ui.transactions.TransactionsViewModel
+import com.example.bondoyap.ui.transactions.TransactionsViewModelFactory
 import com.github.mikephil.charting.charts.PieChart
 import com.github.mikephil.charting.components.Legend
 import com.github.mikephil.charting.data.PieData
@@ -23,7 +27,11 @@ class GraphFragment : Fragment() {
         fun newInstance() = GraphFragment()
     }
 
-    private val viewModel: GraphViewModel by viewModels()
+    private val transactionsViewModel: TransactionsViewModel by viewModels {
+        TransactionsViewModelFactory((requireContext().applicationContext as TransactionsApplication).repository)
+    }
+
+    private lateinit var pieChart: PieChart
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
@@ -36,40 +44,48 @@ class GraphFragment : Fragment() {
         savedInstanceState: Bundle?
     ): View {
         val root = inflater.inflate(R.layout.fragment_graph, container, false)
-        val pieChart: PieChart = root.findViewById(R.id.pieChart)
-
-        val entries = listOf(
-            PieEntry(1f, "Entry 1"),
-            PieEntry(2f, "Entry 2"),
-            PieEntry(3f, "Entry 3")
-        )
-
-        val pieDataSet = PieDataSet(entries, "")
-        pieDataSet.colors = ColorTemplate.COLORFUL_COLORS.toList()
-
-        val pieData = PieData(pieDataSet)
-
-        pieChart.data = pieData
-        pieChart.description.isEnabled = false
-
-        val legend = pieChart.legend
-        val orientation = resources.configuration.orientation
-        if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
-            legend.horizontalAlignment = Legend.LegendHorizontalAlignment.RIGHT
-            legend.verticalAlignment = Legend.LegendVerticalAlignment.CENTER
-        } else {
-            legend.horizontalAlignment = Legend.LegendHorizontalAlignment.CENTER
-            legend.verticalAlignment = Legend.LegendVerticalAlignment.BOTTOM
-        }
-        legend.setDrawInside(false)
-
-        if (isDarkTheme()) {
-            legend.textColor = ContextCompat.getColor(requireContext(), R.color.white)
-        } else {
-            legend.textColor = ContextCompat.getColor(requireContext(), R.color.black)
-        }
-
-        pieChart.invalidate()
+        pieChart = root.findViewById(R.id.pieChart)
+
+        transactionsViewModel.pemasukanCount.observe(viewLifecycleOwner, Observer { pemasukanCount ->
+            transactionsViewModel.pengeluaranCount.observe(viewLifecycleOwner, Observer { pengeluaranCount ->
+                val entries = listOf(
+                    PieEntry(pemasukanCount.toFloat(), "Pemasukan"),
+                    PieEntry(pengeluaranCount.toFloat(), "Pengeluaran")
+                )
+
+                val colors = mutableListOf<Int>()
+                colors.add(ContextCompat.getColor(requireContext(), R.color.green))
+                colors.add(ContextCompat.getColor(requireContext(), R.color.red))
+
+                val pieDataSet = PieDataSet(entries, "")
+                pieDataSet.colors = colors
+
+                val pieData = PieData(pieDataSet)
+
+                pieChart.data = pieData
+                pieChart.description.isEnabled = false
+
+                val legend = pieChart.legend
+                val orientation = resources.configuration.orientation
+                if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
+                    legend.horizontalAlignment = Legend.LegendHorizontalAlignment.RIGHT
+                    legend.verticalAlignment = Legend.LegendVerticalAlignment.CENTER
+                } else {
+                    legend.horizontalAlignment = Legend.LegendHorizontalAlignment.CENTER
+                    legend.verticalAlignment = Legend.LegendVerticalAlignment.BOTTOM
+                }
+                legend.setDrawInside(false)
+
+                if (isDarkTheme()) {
+                    legend.textColor = ContextCompat.getColor(requireContext(), R.color.white)
+                } else {
+                    legend.textColor = ContextCompat.getColor(requireContext(), R.color.black)
+                }
+
+                pieChart.invalidate()
+            })
+        })
+
         return root
     }
 
diff --git a/app/src/main/java/com/example/bondoyap/ui/transactions/TransactionsViewModel.kt b/app/src/main/java/com/example/bondoyap/ui/transactions/TransactionsViewModel.kt
index e5d26b61b11d09aaef1e41fdfcbbf6cb3f35bbd0..2e06e88c972e779c7b3017a534f00cb5f6fdf083 100644
--- a/app/src/main/java/com/example/bondoyap/ui/transactions/TransactionsViewModel.kt
+++ b/app/src/main/java/com/example/bondoyap/ui/transactions/TransactionsViewModel.kt
@@ -15,6 +15,8 @@ class TransactionsViewModel(
     private val repository: TransactionsRepository
 ): ViewModel() {
     val allTransactions: LiveData<List<Transactions>> = repository.allTransactions.asLiveData()
+    val pemasukanCount: LiveData<Int> = repository.getPemasukanCount().asLiveData()
+    val pengeluaranCount: LiveData<Int> = repository.getPengeluaranCount().asLiveData()
 
     fun upsert(transactions: Transactions) = viewModelScope.launch {
         repository.upsert(transactions)
diff --git a/app/src/main/java/com/example/bondoyap/ui/transactions/data/TransactionsDao.kt b/app/src/main/java/com/example/bondoyap/ui/transactions/data/TransactionsDao.kt
index a6701873192e576ebe17d6f2b8ed31706c7cac85..f02276d8cd7b09c5d5008953cd3602e30006d5b0 100644
--- a/app/src/main/java/com/example/bondoyap/ui/transactions/data/TransactionsDao.kt
+++ b/app/src/main/java/com/example/bondoyap/ui/transactions/data/TransactionsDao.kt
@@ -26,4 +26,10 @@ interface TransactionsDao {
 
     @Query("DELETE FROM transactions")
     suspend fun deleteAllTransactions()
+
+    @Query("SELECT COUNT(transactions.id) FROM transactions WHERE transactions.is_pemasukan = 1")
+    fun getPemasukanCount(): Flow<Int>
+
+    @Query("SELECT COUNT(transactions.id) FROM transactions WHERE transactions.is_pemasukan = 0")
+    fun getPengeluaranCount(): Flow<Int>
 }
\ No newline at end of file
diff --git a/app/src/main/java/com/example/bondoyap/ui/transactions/data/TransactionsRepository.kt b/app/src/main/java/com/example/bondoyap/ui/transactions/data/TransactionsRepository.kt
index 752e4e908bbf87e6eb62ca6ad7551a7ff0071359..43b83a602b22ef3f4ccfa1e889d357f7dbce1bc0 100644
--- a/app/src/main/java/com/example/bondoyap/ui/transactions/data/TransactionsRepository.kt
+++ b/app/src/main/java/com/example/bondoyap/ui/transactions/data/TransactionsRepository.kt
@@ -28,4 +28,12 @@ class TransactionsRepository(private val transactionsDao: TransactionsDao) {
     suspend fun deleteAllTransactions() {
         transactionsDao.deleteAllTransactions()
     }
+
+    fun getPemasukanCount(): Flow<Int> {
+        return transactionsDao.getPemasukanCount()
+    }
+
+    fun getPengeluaranCount(): Flow<Int> {
+        return transactionsDao.getPengeluaranCount()
+    }
 }
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 5b69a31ff5fc8b40517d0e5624620e080be37343..dca02c2d4e6b6474144e731710b897d7d6b9a0a2 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -8,5 +8,6 @@
     <color name="black">#FF000000</color>
     <color name="white">#FFFFFFFF</color>
     <color name="red">#FF0000</color>
+    <color name="green">#50C878</color>
     <color name="ic_launcher_background">#f6bc2b</color>
 </resources>
\ No newline at end of file