I am trying to access the screen coordinates respect to values I am using to draw graph. But Now I am trying to access coordinated using toSreeenPoint method in XYChart class. here is the code I am using,
if (layout != null) {
layout.removeAllViews();
mChartView = ChartFactory.getCubeLineChartView(MyActivity.this, dataset, multiRenderer, 0.33f);
layout.addView(mChartView);
// mChartView = null;
mChartView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
SeriesSelection ss = mChartView.getCurrentSeriesAndPoint();
XYChart chart = new LineChart(dataset, multiRenderer);
XYSeries series = dataset.getSeriesAt(0);
if(chart != null) {
for(int i = 0; i < series.getItemCount(); i++) {
Log.d(TAG, "Serieous COunt"+series.getX(i));
Log.d(TAG, "Serieous COunt#1"+series.getY(i));
Log.d(TAG, "Type is"+chart.getChartType());
double[] xy = chart.toScreenPoint(new double[]{series.getX(i), series.getY(i)});
//Log.d(TAG, "Check is right" + chart.getSeriesAndPointForScreenCoordinate(new Point((float) xy[0], (float) xy[1])));
}
} else {
Log.d(TAG, "Check is Wrong");
}
return false;
}
});
}
but some reason It is crashing NULL POint Exception on chart.toScreenPoint line. I checked using longs nothing is null untill that line. Kindly help to find what I am doing wrong...