mirror of
https://github.com/dzeiocom/OpenHealth.git
synced 2025-04-22 19:02:16 +00:00
fix: chart distances
This commit is contained in:
parent
0e4e24ac67
commit
1aa7f2d89e
@ -169,7 +169,7 @@ kapt {
|
||||
|
||||
dependencies {
|
||||
// Dzeio Charts
|
||||
implementation("com.dzeio:charts:0.1.6")
|
||||
implementation("com.dzeio:charts:0.1.7")
|
||||
|
||||
// Dzeio Crash Handler
|
||||
implementation("com.dzeio:crashhandler:1.0.1")
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user