Skip to content

Commit

Permalink
Fix: dataSet 변수명 변경 [16-SulGore#27]
Browse files Browse the repository at this point in the history
  • Loading branch information
Cha-Ji committed Oct 17, 2022
1 parent bf9a6dc commit 0e5d20d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.sulgorae.crypto.ratio
import android.os.Bundle
import android.view.View
import androidx.lifecycle.ViewModelProvider
import com.github.mikephil.charting.components.XAxis
import com.sulgorae.crypto.R
import com.sulgorae.crypto.common.BaseFragment
import com.sulgorae.crypto.databinding.FragmentKRatioBinding
Expand All @@ -26,11 +25,11 @@ class KRationFragment : BaseFragment<FragmentKRatioBinding>(R.layout.fragment_k_
}

private fun setChart() {
ratioViewModel.setProfit()
ratioViewModel.setMddDataSet()
}

private fun showChart() {
ratioViewModel.kDataSet.observe(requireActivity()) { dataSet ->
ratioViewModel.mddDataSetByK.observe(requireActivity()) { dataSet ->
with (binding.lineChartKRatio) {
val inputData = dataSet.toLineData(R.drawable.crypto1)
data = inputData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class MddRatioFragment : BaseFragment<FragmentMddRatioBinding>(R.layout.fragment
}

private fun setChart() {
ratioViewModel.setProfit()
ratioViewModel.setMddDataSet()
}

private fun showChart() {
ratioViewModel.kDataSet.observe(requireActivity()) { dataSet ->
ratioViewModel.mddDataSetByK.observe(requireActivity()) { dataSet ->
with(binding.lineChartPRatio) {
val inputData = dataSet.toLineData(R.drawable.crypto1)
data = inputData
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/com/sulgorae/crypto/ratio/RatioViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ class RatioViewModel(
private val quotationDataSource: QuotationDataSource
) : ViewModel() {

private var _kDataSet = MutableLiveData<List<MddDataSet>>()
val kDataSet: LiveData<List<MddDataSet>> = _kDataSet
private var _mddDataSetByK = MutableLiveData<List<MddDataSet>>()
val mddDataSetByK: LiveData<List<MddDataSet>> = _mddDataSetByK

fun setProfit(market: String = "KRW-BTC") {
fun setMddDataSet(market: String = "KRW-BTC") {
viewModelScope.launch {
_kDataSet.value = kList.map { k ->
_mddDataSetByK.value = kList.map { k ->
with (getMaxMinProfit(market, toList, k)) {
MddDataSet(mdd = getMdd(first, second), period = toList.first() + toList.last(), k = k)
}
Expand Down

0 comments on commit 0e5d20d

Please # to comment.