jjoe64 / GraphView

Android Graph Library for creating zoomable and scrollable line and bar graphs.
https://github.com/jjoe64/GraphView/wiki
Other
2.76k stars 811 forks source link

null pointer exception with mGraph.addSeries(series) #659

Open Duttabhi opened 4 years ago

Duttabhi commented 4 years ago
private void createLineGraph(List<String[]> result){
        DataPoint[] dataPoints = new DataPoint[result.size()];
        for (int i = 1; i < 5; i++){
            String [] rows = result.get(i);
            Log.d(TAG, "Output " + (i+1) + " " + (i+2));
            dataPoints[i] = new DataPoint(i+1, i+2);
        }
        LineGraphSeries<DataPoint> series = new LineGraphSeries<DataPoint>(dataPoints);
            mGraph.addSeries(series);
}

Error: java.lang.NullPointerException: Attempt to invoke interface method 'double com.jjoe64.graphview.series.DataPointInterface.getX()' on a null object reference