I am having an issue getting the onclicklistener to work with achartengine1.0.0 for android. Specifically I am not able to return anything from the ".getCurrentSeriesAndPoint" (always null).
SeriesSelection seriesSelection = gView.getCurrentSeriesAndPoint();
So I have a class which create my chart view as follows...
public class xyScatter extends Application {
public GraphicalView getGView(Context context) {
...(STUFF)...
mRenderer.setClickEnabled(true);
mRenderer.setSelectableBuffer(100);
...(STUFF)...
return ChartFactory.getScatterChartView(context, dataset, mRenderer);
}
}
Then in my activity I have the following method
private void displayXY() {
xyScatter xyScat = new xyScatter();
final GraphicalView gView = xyScat.getGView(this);
glayout.removeAllViews();
glayout.addView(gView);
gView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SeriesSelection seriesSelection = gView.getCurrentSeriesAndPoint();
Log.d("seriesSelection", String.valueOf(seriesSelection));
if (seriesSelection == null) {
Log.d("OnClickXY", "Nothing Selected");
} else {
Log.d("OnClickXY", "Something Selected");
}
}
});
}
Does this have something to do with me adding the chart as a GraphicalView within a linearLayout?
I tried searching several sites with no avail. Example