mirror of
https://github.com/dzeiocom/OpenHealth.git
synced 2025-06-12 17:19:18 +00:00
fix: label not correctly positionned
This commit is contained in:
@ -47,9 +47,42 @@ class StepsHomeFragment :
|
||||
|
||||
val chart = binding.chart
|
||||
|
||||
val serie = BarSerie(chart)
|
||||
// setup serie
|
||||
val serie = BarSerie(chart).apply {
|
||||
barPaint.color = MaterialColors.getColor(
|
||||
requireView(),
|
||||
com.google.android.material.R.attr.colorPrimary
|
||||
)
|
||||
textPaint.color = MaterialColors.getColor(
|
||||
requireView(),
|
||||
com.google.android.material.R.attr.colorOnPrimary
|
||||
)
|
||||
}
|
||||
|
||||
chart.series = arrayListOf(serie)
|
||||
chart.apply {
|
||||
series = arrayListOf(serie)
|
||||
debug = true
|
||||
|
||||
yAxis.apply {
|
||||
setYMin(0f)
|
||||
textLabel.color = MaterialColors.getColor(
|
||||
requireView(),
|
||||
com.google.android.material.R.attr.colorOnPrimaryContainer
|
||||
)
|
||||
linePaint.color = MaterialColors.getColor(
|
||||
requireView(),
|
||||
com.google.android.material.R.attr.colorOnPrimaryContainer
|
||||
)
|
||||
//
|
||||
onValueFormat = { value -> "${value.toInt()}" }
|
||||
}
|
||||
|
||||
xAxis.apply {
|
||||
increment = 3600000.0
|
||||
displayCount = 168
|
||||
// displayCount = 24
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.items.observe(viewLifecycleOwner) { list ->
|
||||
adapter.set(list)
|
||||
@ -68,34 +101,12 @@ class StepsHomeFragment :
|
||||
// )
|
||||
|
||||
// chart.xAxis.labels.size = 32f
|
||||
chart.yAxis.apply {
|
||||
setYMin(0f)
|
||||
textLabel.color = MaterialColors.getColor(
|
||||
requireView(),
|
||||
com.google.android.material.R.attr.colorOnBackground
|
||||
)
|
||||
// linePaint.color = MaterialColors.getColor(
|
||||
// requireView(),
|
||||
// com.google.android.material.R.attr.colorOutline
|
||||
// )
|
||||
// onValueFormat = onValueFormat@{ value, short ->
|
||||
// if (short) {
|
||||
// return@onValueFormat value.toInt().toString()
|
||||
// } else {
|
||||
// return@onValueFormat "${value.toInt()} steps"
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
serie.entries = list.reversed().map {
|
||||
return@map Entry(it.timestamp.toDouble(), it.value.toFloat())
|
||||
} as ArrayList<Entry>
|
||||
|
||||
chart.xAxis.apply {
|
||||
increment = (1000 * 60 * 60).toDouble()
|
||||
displayCount = 24 * 7
|
||||
x = serie.entries.first().x
|
||||
}
|
||||
chart.xAxis.x = serie.entries.first().x
|
||||
|
||||
// chart.xAxis.onValueFormat = onValueFormat@{
|
||||
// val formatter = DateFormat.getDateTimeInstance(
|
||||
|
@ -2,11 +2,7 @@ package com.dzeio.openhealth.ui.weight
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.*
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.preference.PreferenceManager
|
||||
@ -37,6 +33,7 @@ class ListWeightFragment :
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
// FIXME: deprecated
|
||||
setHasOptionsMenu(true)
|
||||
|
||||
if (viewModel.goalWeight != null) {
|
||||
|
Reference in New Issue
Block a user