summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Jacquart <guillaume.jacquart@hoodbrains.com>2023-03-08 18:40:00 +0100
committerGuillaume Jacquart <guillaume.jacquart@hoodbrains.com>2023-03-08 18:40:00 +0100
commitc04e16eac8e614b1a7dabd4d1aed8d3200b73a64 (patch)
tree23731cdca6a79460c3dcc2fe466f40eaf29051cb
parent5aa1f270323bf36a2797cef3f486a1c22e76c308 (diff)
5422 - fix first graduation label on big screens.
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/common/GraphHolder.kt3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/src/main/java/foundation/e/privacycentralapp/common/GraphHolder.kt b/app/src/main/java/foundation/e/privacycentralapp/common/GraphHolder.kt
index 51064d2..a25b68e 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/common/GraphHolder.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/common/GraphHolder.kt
@@ -45,6 +45,7 @@ import com.github.mikephil.charting.renderer.XAxisRenderer
import com.github.mikephil.charting.utils.MPPointF
import foundation.e.privacycentralapp.R
import foundation.e.privacycentralapp.common.extensions.dpToPxF
+import kotlin.math.floor
class GraphHolder(val barChart: BarChart, val context: Context, val isMarkerAbove: Boolean = true) {
var data = emptyList<Pair<Int, Int>>()
@@ -176,7 +177,7 @@ class GraphHolder(val barChart: BarChart, val context: Context, val isMarkerAbov
textColor = context.getColor(R.color.primary_text)
valueFormatter = object : ValueFormatter() {
override fun getAxisLabel(value: Float, axis: AxisBase?): String {
- return graduations?.getOrNull(value.toInt() + 1) ?: ""
+ return graduations?.getOrNull(floor(value).toInt() + 1) ?: ""
}
}
}