Mise à jour des légendes des graphiques
This commit is contained in:
@@ -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<ILineDataSet> = ArrayList()
|
||||
dataSets.add(temperatureDataSet)
|
||||
|
||||
Reference in New Issue
Block a user