diff options
author | Alexandre Roux <alexandre.roux.danzi@lostpod.me> | 2023-03-09 10:00:21 +0000 |
---|---|---|
committer | Alexandre Roux <alexandre.roux.danzi@lostpod.me> | 2023-03-09 10:00:21 +0000 |
commit | f7a657444277a71fc3b3cb114d4f6b58255dd15c (patch) | |
tree | 9fb78020cedfef5768bacffa933351d5e83b208e /app/src | |
parent | 5933c6016a442b2ed59da2fd66ac90c8f60d7931 (diff) | |
parent | c04e16eac8e614b1a7dabd4d1aed8d3200b73a64 (diff) |
Merge branch '5422-fix_graph_label_1_9RC2' into 'main'
5422 - fix first graduation label on big screens.
See merge request e/os/advanced-privacy!118
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/foundation/e/privacycentralapp/common/GraphHolder.kt | 3 |
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) ?: "" } } } |