0

I draw barchart in my Android project, but I can't see x-axis label completely about g, j....etc. These letters are not shown completely. The letters cut off. I chaged many things like margin, padding.... but I can not change x-axis label. My code is below.

        binding.contributorsChart.apply {
            setDrawBarShadow(false) 
            setTouchEnabled(false)
            setPinchZoom(false)
            setDrawGridBackground(false)
            description.isEnabled = false
            legend.isEnabled = false
            axisRight.isEnabled = false
            axisLeft.apply {
                axisMinimum = 0f
                granularity = 10f
                setDrawLabels(true)
                setDrawGridLines(true)
                setDrawAxisLine(true)
                axisLineColor = ContextCompat.getColor(context, R.color.black)
                gridColor = ContextCompat.getColor(context, R.color.black)
                textColor = ContextCompat.getColor(context, R.color.black)
                textSize = 13f
            }
            xAxis.apply {
                yOffset = 5f
                isEnabled = true
                position = XAxis.XAxisPosition.BOTTOM 
                granularity = 1f 
                setDrawAxisLine(true)
                setDrawGridLines(false)
                textColor = ContextCompat.getColor(context, R.color.black)
                textSize = 12f 
                valueFormatter = MyXAxisFormatter(contributors) 
            }
            animateY(500) // 밑에서부터 올라오는 애니매이션 적용
        }
        
        data.apply {
            setValueTextSize(12f)
            barWidth = 0.3f
        }
        binding.contributorsChart.data = data
        binding.contributorsChart.invalidate()
        binding.contributorsChart.visibility = View.VISIBLE

I changed margin, padding, ... etc.

심영수
  • 1
  • 1

0 Answers0