Skip to content

Commit

Permalink
[android] Minor fix for pressure graph rendering (#15564)
Browse files Browse the repository at this point in the history
Some graph labels were truncated.

Signed-off-by: Damian Krolik <[email protected]>
  • Loading branch information
Damian-Nordic authored Feb 28, 2022
1 parent 4668421 commit 031edd0
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,17 @@ class SensorClientFragment : Fragment() {
sensorGraph.viewport.isXAxisBoundsManual = true
sensorGraph.viewport.setMinX(currentTime.toDouble())
sensorGraph.viewport.setMaxX(currentTime.toDouble() + MIN_REFRESH_PERIOD_S * 1000 * MAX_DATA_POINTS)
sensorGraph.gridLabelRenderer.padding = 20
sensorGraph.gridLabelRenderer.padding = 30
sensorGraph.gridLabelRenderer.numHorizontalLabels = 4
sensorGraph.gridLabelRenderer.setHorizontalLabelsAngle(150)
sensorGraph.gridLabelRenderer.labelFormatter = object : LabelFormatter {
override fun setViewport(viewport: Viewport?) = Unit
override fun formatLabel(value: Double, isValueX: Boolean): String {
if (!isValueX)
return "%.2f".format(value)
return SimpleDateFormat("H:mm:ss").format(Date(value.toLong())).toString()
if (isValueX)
return SimpleDateFormat("H:mm:ss").format(Date(value.toLong())).toString()
if (value >= 100.0)
return "%.1f".format(value)
return "%.2f".format(value)
}
}
}
Expand Down

0 comments on commit 031edd0

Please sign in to comment.