PhilJay / MPAndroidChart

A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.
Other
37.63k stars 9.02k forks source link

Fatal Exception: java.lang.NegativeArraySizeException: -4 #3309

Open harshvishu opened 7 years ago

harshvishu commented 7 years ago

When you rotate device / (Change orientation) the following fatal exception occurs

Line that causes the issue

_LineChart.setData(data);
_LineChart.animateY(250, Easing.EasingOption.EaseInElastic);
 _LineChart.animateX(250, Easing.EasingOption.EaseInElastic);
 _LineChart.invalidate();

Logcat

Fatal Exception: java.lang.NegativeArraySizeException: -4
       at com.github.mikephil.charting.utils.Transformer.generateTransformedValuesLine(Transformer.java:178)
       at com.github.mikephil.charting.renderer.LineChartRenderer.drawValues(LineChartRenderer.java:547)
       at com.github.mikephil.charting.charts.BarLineChartBase.onDraw(BarLineChartBase.java:263)
       at android.view.View.draw(View.java:17291)
       at android.view.View.updateDisplayListIfDirty(View.java:16273)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3715)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3695)
       at android.view.View.updateDisplayListIfDirty(View.java:16236)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3715)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3695)
       at android.view.View.updateDisplayListIfDirty(View.java:16236)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3715)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3695)
       at android.view.View.updateDisplayListIfDirty(View.java:16236)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3715)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3695)
       at android.view.View.updateDisplayListIfDirty(View.java:16236)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3715)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3695)
       at android.view.View.updateDisplayListIfDirty(View.java:16236)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3715)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3695)
       at android.view.View.updateDisplayListIfDirty(View.java:16236)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3715)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3695)
       at android.view.View.updateDisplayListIfDirty(View.java:16236)
       at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:652)
       at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:658)
       at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:766)
       at android.view.ViewRootImpl.draw(ViewRootImpl.java:2830)
       at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2629)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2236)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1275)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6439)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:943)
       at android.view.Choreographer.doCallbacks(Choreographer.java:755)
       at android.view.Choreographer.doFrame(Choreographer.java:690)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:929)
       at android.os.Handler.handleCallback(Handler.java:751)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6334)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

This log is from Device with following configuration Device : ONEPLUS A5000 OS : 7.1.1

tranbaothang1989 commented 7 years ago

This topic #2077 fixed my issue! Check more Update: