I'm trying to show the label of my LineDataSet, but it didn't show on my android chart. It should be 4 labels at the bottom, with 4 different colors and names. I simply the code so I can post it here
Here is my code :
val chartLineDataSet = LineDataSet(arrayData, "Phasa A")
chartLineDataSet.mode = LineDataSet.Mode.CUBIC_BEZIER
chartLineDataSet.color = Color.RED
chartLineDataSet.circleRadius = 5f
chartLineDataSet.lineWidth = 2f
chartLineDataSet.setCircleColor(Color.RED)
chartLineDataSet.valueTextColor = Color.RED
chartLineDataSet.valueTextSize = 10F
chartLineDataSet.setDrawValues(false)
chartLineDataSet.setDrawCircleHole(false)
chartLineDataSet.valueFormatter = MyValueFormatter()
val lineDatas: MutableList<ILineDataSet> = ArrayList()
lineDatas.add(chartLineDataSet)
binding.lineChart.let {
it.description.isEnabled = false
it.xAxis.position = XAxis.XAxisPosition.BOTTOM
it.data = LineData(lineDatas)
it.animateXY(100, 500)
it.xAxis.setDrawGridLines(true)
it.axisLeft.textColor = Color.BLACK
it.axisRight.textColor = Color.BLACK
it.xAxis.textColor = Color.BLACK
it.legend.textColor = Color.BLACK
it.axisRight.isEnabled = false
it.axisLeft.isEnabled = true
it.isClickable = false
it.setVisibleXRangeMaximum(7F)
}
and the result for the code above
Did I miss something ?
Nevermind, I forgot to set enabled / true the binding.chart.legend
. Finally, the labels are already shown.