How to stop highlight when any bar is clicked in MPAndroidChart?

I am using barChart of MPAndroidChart library. My problem is whenever I click any bar of that bar chart its color change something like an overlay. I have tried several techniques but nothing is working. I have tried following codes :

    barChart.setHighlightPerTapEnabled(false);

Upper line do this trick for me but it also disables click event, that means if I set HighlightPerTapEnabled = false then my onValue selected listener does not fire anymore. I also have tried below two lines but nothing is working as my expectation.

    mChart.setTouchEnabled(false);
    mChart.setDrawBarShadow(false);

All i want just to remove this change of color when a user clicks any bar of that barChart. Thanks in Advance.

Upvotes: 4

Views: 6016

Answers (6)

Abdev
Abdev

Reputation: 331

for the newer versions , you can use the code below

mBarChart.isHighlightPerTapEnabled=false

Upvotes: 0

Jackson Dias da Silva
Jackson Dias da Silva

Reputation: 31

Kotlin:

dataSet.highLightColor = Color.TRANSPARENT

Upvotes: 0

None of the above answers is working. However, I solved this issue by :

BarDataSet barDataSet = new BarDataSet(entries, "Year : 2017");
 barDataSet.setHighLightAlpha(3);

Upvotes: 0

Muhammed Ashraf
Muhammed Ashraf

Reputation: 79

from version 3.1.0, 'barDataSet.setHighLightAlpha(0)' will do the job

Upvotes: 4

user2851150
user2851150

Reputation: 405

   barDataSet.setHighLightColor(Color.TRANSPARENT);
    barDataSet.setHighLightAlpha(0);

This will snippet will help to remove selection color

Upvotes: 2

Don Chakkappan
Don Chakkappan

Reputation: 7560

You just need to disable the HighLight property on BarData

BarData data = new BarData(dataSets);
data.setHighlightEnabled(false);

Upvotes: 14

Related Questions