Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have the same problem. Initially the problem comes from initRange() if you remove a point which was a Max/Min. But after commenting initRange I still get a null pointer on line 'double removedY = removedEntry.getValue();' of remove(). It looks like mXY.removeByIndex(index); returns an element with value set to null but I can't find out why.</p> <p>I'm running on the last revision available on subversion. It looks to me like some kind of race condition maybe since it doesn't fail always a the same time. I built a "sliding-window" loop in which I maintain a given number of constant points on the chart. In this example it's just 3, so after the 3rd point every time i add one I remove another. At first logs look normal:</p> <pre><code>01-11 23:06:48.060: E/AChartGraph(2038): Added 1 item. getIndexForKey: 0 01-11 23:06:48.060: E/AChartGraph(2038): series1.getItemCount(): 1 01-11 23:06:48.060: E/AChartGraph(2038): Added 1 item. getIndexForKey: 1 01-11 23:06:48.060: E/AChartGraph(2038): series1.getItemCount(): 2 01-11 23:06:48.160: E/AChartGraph(2038): Added 1 item. getIndexForKey: 2 01-11 23:06:48.160: E/AChartGraph(2038): series1.getItemCount(): 3 01-11 23:06:48.160: E/AChartGraph(2038): Removed item 0. series1.getItemCount(): 2 01-11 23:06:48.160: E/AChartGraph(2038): Added 1 item. getIndexForKey: 2 01-11 23:06:48.160: E/AChartGraph(2038): series1.getItemCount(): 3 01-11 23:06:48.160: E/AChartGraph(2038): Removed item 0. series1.getItemCount(): 2 01-11 23:06:48.160: E/AChartGraph(2038): Added 1 item. getIndexForKey: 2 01-11 23:06:48.160: E/AChartGraph(2038): series1.getItemCount(): 3 01-11 23:06:48.160: E/AChartGraph(2038): Removed item 0. series1.getItemCount(): 2 01-11 23:06:48.160: E/AChartGraph(2038): Added 1 item. getIndexForKey: 2 01-11 23:06:48.160: E/AChartGraph(2038): series1.getItemCount(): 3 </code></pre> <p>This goes on and on a bit until this happens:</p> <pre><code>01-11 23:06:55.300: E/AChartGraph(2038): Added 1 item. getIndexForKey: 2 01-11 23:06:55.300: E/AChartGraph(2038): series1.getItemCount(): 3 01-11 23:06:55.300: E/AChartGraph(2038): Removed item 0. series1.getItemCount(): 2 01-11 23:06:55.300: E/AChartGraph(2038): Added 1 item. getIndexForKey: 1 01-11 23:06:55.300: E/AChartGraph(2038): series1.getItemCount(): 2 01-11 23:06:55.300: E/AChartGraph(2038): Removed item 0. series1.getItemCount(): 1 01-11 23:06:55.300: E/AChartGraph(2038): Added 1 item. getIndexForKey: 2 01-11 23:06:55.300: E/AChartGraph(2038): series1.getItemCount(): 2 01-11 23:06:55.300: W/dalvikvm(2038): threadid=14: thread exiting with uncaught exception (group=0x40bfb930) 01-11 23:06:55.320: E/AndroidRuntime(2038): FATAL EXCEPTION: AsyncTask #4 01-11 23:06:55.320: E/AndroidRuntime(2038): java.lang.RuntimeException: An error occured while executing doInBackground() 01-11 23:06:55.320: E/AndroidRuntime(2038): at android.os.AsyncTask$3.done(AsyncTask.java:299) 01-11 23:06:55.320: E/AndroidRuntime(2038): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352) 01-11 23:06:55.320: E/AndroidRuntime(2038): at java.util.concurrent.FutureTask.setException(FutureTask.java:219) 01-11 23:06:55.320: E/AndroidRuntime(2038): at java.util.concurrent.FutureTask.run(FutureTask.java:239) 01-11 23:06:55.320: E/AndroidRuntime(2038): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 01-11 23:06:55.320: E/AndroidRuntime(2038): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 01-11 23:06:55.320: E/AndroidRuntime(2038): at java.lang.Thread.run(Thread.java:856) 01-11 23:06:55.320: E/AndroidRuntime(2038): Caused by: java.lang.NullPointerException 01-11 23:06:55.320: E/AndroidRuntime(2038): at org.achartengine.model.XYSeries.getY(XYSeries.java:169) 01-11 23:06:55.320: E/AndroidRuntime(2038): at org.achartengine.model.XYSeries.initRange(XYSeries.java:83) 01-11 23:06:55.320: E/AndroidRuntime(2038): at org.achartengine.model.XYSeries.remove(XYSeries.java:140) 01-11 23:06:55.320: E/AndroidRuntime(2038): at com.mbev.android.Tmty.Helpers.AChartGraph.addAndPrune(AChartGraph.java:226) 01-11 23:06:55.320: E/AndroidRuntime(2038): at com.mbev.android.Tmty.DashboardFragment$startUpdateTmtyThread.doInBackground(DashboardFragment.java:284) 01-11 23:06:55.320: E/AndroidRuntime(2038): at com.mbev.android.Tmty.DashboardFragment$startUpdateTmtyThread.doInBackground(DashboardFragment.java:1) 01-11 23:06:55.320: E/AndroidRuntime(2038): at android.os.AsyncTask$2.call(AsyncTask.java:287) 01-11 23:06:55.320: E/AndroidRuntime(2038): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 01-11 23:06:55.320: E/AndroidRuntime(2038): ... 3 more </code></pre> <p>Notice how suddenly the index for the added point is 1 instead of 2, and the itemCount goes down to 2 also, we've just lost a point!. If we test this with more points it takes longer and we see logs in which we gradually start "loosing" points until it crashes on XYSeries.getY. I believe it is trying to remove one of those points which mysteriously disappeared earlier.</p> <p><strong>EDIT 1:</strong> In this case I was plotting a time-series and the error came when I added 2 points with the same key (date in this case). <strong>The remove function removes all points for a given key, not sure if it's intended or a bug though.</strong> But it might well be the same error you have.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload