I'm working with MPAndroidChart on my app for drawing line charts, and I need to know the X and Y values of a touched item. My current code is:
chart = (LineChart) findViewById(R.id.weightChart);
chart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() {
@Override
public void onValueSelected(Entry e, int dataSetIndex, Highlight h) {
weights.get(e.getXIndex());
Log.i("Entry", String.valueOf(e));
Log.i("dataSetIndex", String.valueOf(dataSetIndex));
Log.i("Highlight", String.valueOf(h));
}
@Override
public void onNothingSelected() {
}
});
So that when an iten is touched, dataSetIndex is always 0,
Highlight is: Highlight, xIndex: x value, dataSetIndex: 0, stackIndex (only stacked barentry): -1,
and Entry is: Entry, xIndex: x value val (sum): y value
So, how could I get the X and Y values from the entry without having to format the Entry?
Thanks a lot