Highlighting central element of the bar data on the bar chart
Summary Hello, I'm using the BarChart to show the BarData basing on BarDataSet. I disabled all highlighting features on BarChart
mChart.setDoubleTapToZoomEnabled(false);
mChart.setHighlightPerTapEnabled(false);
mChart.setHighlightFullBarEnabled(false);
mChart.setHighlightPerDragEnabled(false);
on BarDataSet
barDataSet.setHighLightAlpha(0);
barDataSet.setHighLightColor(Color.TRANSPARENT);
barDataSet.setHighlightEnabled(false);
on BarData
barData.setHighlightEnabled(false);
But (only) central element of the bar chart is still clickable and highlights after tapping it. Did I forget about some flags or methods to disable highlighting or it is a bug?
Expected Behavior
All the bars should be non-clickable and not highlighted.
Device:
- Device: Google Nexus 6
- Android Version 7.0
- Library Version 3.1.0
I'm attempting the opposite, but have the same results. I'm trying to allow tapping on any bar segment in the chart to highlight, but the only item that will ever highlight is the center entry.
I am also using a HorizontalBarChart. I have stacked BarEntry values.
Adding an OnChartValueSelectedListener', I can see that onNothingSelected` is fired almost every time I tap on the chart, other than over the middle bar entry.
For anyone that happens upon this and has the same issue I did with only the center item highlighting:
If your entries are rendering in reversed order, reverse your data set BEFORE building the BarEntry list. The way the highlighting algorithm works, it expects Entry[0].x <= Entry[1].x <= Entry[2].x and so on. During the process it's doing a binary search to find the closest value, and if your X values are in reversed order, that search will fail except for the center value.