-1

How can i change the particular label text color in xaxis using Horizontal Bar Chart. Please show the attached screenshot and code. [Here is the screen short]

I have changed the bar colour in to black but i have to change that text colour corresponding to that bar(For example:(You#) colour need to be change).The following code i have tried so far.

    XAxis xAxis1 = horizontalBarChart.getXAxis();
    xAxis1.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis1.setTextSize(8);
    xAxis1.setSpaceBetweenLabels(8);
    xAxis1.setTypeface(tf);
    YAxis leftAxis = horizontalBarChart.getAxisLeft();
    leftAxis.setEnabled(false);
    for(int j=0;j<BarEntryLabels1.size();j++){
        if ((BarEntryLabels1.get(j).contains("You"))){
            xAxis1.setTextColor(Color.parseColor("#000000"));
        }else{
            xAxis1.setTextColor(Color.parseColor("#701112"));
        }
    }

Any code and help would be appreciate, Thanks in advance.

Farmer
  • 4,093
  • 3
  • 23
  • 47
Sunisha Guptan
  • 1,555
  • 17
  • 44

1 Answers1

0

If you wand to change the chart label color then try this code

chart.getAxisLeft().setTextColor(...); // left y-axis
chart.getXAxis().setTextColor(...);
chart.getLegend().setTextColor(...);

Or you can do by this way Check this answer. For more detail about Axis please check this.

Farmer
  • 4,093
  • 3
  • 23
  • 47