From 5d908dca42e1f96785aee7850f8a7042fb45c134 Mon Sep 17 00:00:00 2001 From: arussac Date: Thu, 13 Mar 2025 09:40:08 +0100 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20des=20l=C3=A9gendes=20de?= =?UTF-8?q?s=20graphiques?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dreamteam/timelapse/ProjectActivity.kt | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/app/src/main/java/com/dreamteam/timelapse/ProjectActivity.kt b/app/src/main/java/com/dreamteam/timelapse/ProjectActivity.kt index fe81356..a040e65 100644 --- a/app/src/main/java/com/dreamteam/timelapse/ProjectActivity.kt +++ b/app/src/main/java/com/dreamteam/timelapse/ProjectActivity.kt @@ -177,6 +177,34 @@ class ProjectActivity : AppCompatActivity() { xAxis.labelRotationAngle = -90f xAxis.position = XAxis.XAxisPosition.BOTTOM + // Configure the left y-axis + val leftYAxis = temperatureHumidityChart.axisLeft + leftYAxis.labelCount = 6 // Set the number of labels + leftYAxis.setLabelCount(6, true) + leftYAxis.setDrawLabels(true) + leftYAxis.setDrawAxisLine(true) + leftYAxis.setDrawGridLines(true) + leftYAxis.valueFormatter = object : ValueFormatter() { + override fun getFormattedValue(value: Float): String { + return "${value.toInt()} C°" // Append "C°" to the temperature values + } + } + + // Configure the right y-axis + val rightYAxis = temperatureHumidityChart.axisRight + rightYAxis.labelCount = 6 // Set the number of labels + rightYAxis.axisMinimum = 0f // Set minimum value if needed + rightYAxis.axisMaximum = 100f // Set maximum value to 100% + rightYAxis.setLabelCount(6, true) + rightYAxis.setDrawLabels(true) + rightYAxis.setDrawAxisLine(true) + rightYAxis.setDrawGridLines(false) + rightYAxis.valueFormatter = object : ValueFormatter() { + override fun getFormattedValue(value: Float): String { + return "${value.toInt()} %" // Append "%" to the humidity values + } + } + // Add datasets to the chart val dataSets: MutableList = ArrayList() dataSets.add(temperatureDataSet)