1
0
mirror of https://github.com/dzeiocom/OpenHealth.git synced 2025-08-02 22:41:59 +00:00

fix: chart distances

This commit is contained in:
2023-02-28 02:16:47 +01:00
parent 0e4e24ac67
commit 1aa7f2d89e
3 changed files with 10 additions and 3 deletions

View File

@@ -96,6 +96,9 @@ class HomeFragment : BaseFragment<HomeViewModel, FragmentHomeBinding>(HomeViewMo
binding.weightGraph.apply {
val serie = LineSerie(this)
animator.enabled = false
xAxis.dataWidth = 2.4192e+9
xAxis.scrollEnabled = true
ChartUtils.materielTheme(this, requireView())
series = arrayListOf(serie)
}
@@ -181,7 +184,7 @@ class HomeFragment : BaseFragment<HomeViewModel, FragmentHomeBinding>(HomeViewMo
if (list.isEmpty()) {
chart.xAxis.x = 0.0
} else {
chart.xAxis.x = list[0].timestamp.toDouble()
chart.xAxis.x = list.last().timestamp - chart.xAxis.dataWidth!!
}
chart.refresh()

View File

@@ -178,8 +178,10 @@ class ListWeightFragment :
chart.apply {
series = arrayListOf(serie)
animator.enabled = false
yAxis.apply {
setYMin(null)
textLabel.color = MaterialColors.getColor(
requireView(),
com.google.android.material.R.attr.colorOnPrimaryContainer
@@ -194,6 +196,8 @@ class ListWeightFragment :
xAxis.apply {
// 7 day history
dataWidth = 6.048e+8 * 4
scrollEnabled = true
textPaint.color = MaterialColors.getColor(
requireView(),
com.google.android.material.R.attr.colorOnPrimaryContainer
@@ -247,7 +251,7 @@ class ListWeightFragment :
if (list.isEmpty()) {
chart.xAxis.x = 0.0
} else {
chart.xAxis.x = list[0].timestamp.toDouble()
chart.xAxis.x = list.last().timestamp - chart.xAxis.dataWidth!!
}
chart.refresh()