I am using MPAndroidChart in order to create a grouped bars chart. Everything is fine but I am not able to display a MarkerView properly.
I'd like to show some information in the MarkerView depending on entry index, but I just can retrieve x or y values.
refreshContent method
@Override
public void refreshContent(Entry e, Highlight highlight) {
Log.d("MARKER", "x:" + e.getX() + " | y:" + e.getY()
+ " | hx:" + highlight.getX() + " | hy:" + highlight.getY()
+ " | dataindex:" + highlight.getDataIndex()
+ " | datasetindex:" + highlight.getDataSetIndex());
super.refreshContent(e, highlight);
}
This is my log output:
x:2.7349997 | y:65.0 | hx:2.7349997 | hy:65.0 | dataindex:1 | datasetindex:1
Dataindex is always 1 no matter which bar I tap. Datasetindex shows correct value depending on index within group bar.
I realized I can use getData() method from Entry, so I used another constructor for each BarEntry:
new BarEntry(x, y, "extraData");
however, e.getData() is null in refreshContent.
What am I doing wrong?