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.52k
stars
9k
forks
source link
BarChart crashes if marked bar chart gets outside of the visible range. #4984
Summary
If a marked bar chart gets outside the visible range, the whole app crashes with following exception:
W/System.err: java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
W/System.err: at com.github.mikephil.charting.renderer.BarChartRenderer.drawHighlighted(BarChartRenderer.java:468)
W/System.err: at com.github.mikephil.charting.charts.BarLineChartBase.onDraw(BarLineChartBase.java:255)
W/System.err: at android.view.View.draw(View.java:17071)
W/System.err: at android.view.View.updateDisplayListIfDirty(View.java:16053)
W/System.err: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748)
W/System.err: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728)
W/System.err: at android.view.View.updateDisplayListIfDirty(View.java:16016)
W/System.err: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748)
W/System.err: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728)
W/System.err: at android.view.View.updateDisplayListIfDirty(View.java:16016)
W/System.err: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748)
W/System.err: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728)
W/System.err: at android.view.View.updateDisplayListIfDirty(View.java:16016)
W/System.err: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748)
W/System.err: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728)
W/System.err: at android.view.View.updateDisplayListIfDirty(View.java:16016)
W/System.err: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748)
W/System.err: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728)
W/System.err: at android.view.View.updateDisplayListIfDirty(View.java:16016)
W/System.err: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748)
W/System.err: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728)
W/System.err: at android.view.View.updateDisplayListIfDirty(View.java:16016)
W/System.err: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748)
W/System.err: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728)
W/System.err: at android.view.View.updateDisplayListIfDirty(View.java:16016)
W/System.err: at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:656)
W/System.err: at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:662)
W/System.err: at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:770)
W/System.err: at android.view.ViewRootImpl.draw(ViewRootImpl.java:2796)
W/System.err: at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2604)
W/System.err: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2211)
W/System.err: at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1246)
W/System.err: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6301)
W/System.err: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:871)
W/System.err: at android.view.Choreographer.doCallbacks(Choreographer.java:683)
W/System.err: at android.view.Choreographer.doFrame(Choreographer.java:619)
W/System.err: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:857)
W/System.err: at android.os.Handler.handleCallback(Handler.java:751)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
W/System.err: at android.os.Looper.loop(Looper.java:154)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6077)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Expected Behavior
The whole app should not crash, and just continue working.
Possible Solution
Catch the exception and don't try to highlight a Bar Chart that is not visible.
This is still a serious and continuous crash issue which should be solved immediately. At least provide some clue please so that we can handle it. @PhilJay
Summary If a marked bar chart gets outside the visible range, the whole app crashes with following exception: W/System.err: java.lang.ArrayIndexOutOfBoundsException: length=1; index=1 W/System.err: at com.github.mikephil.charting.renderer.BarChartRenderer.drawHighlighted(BarChartRenderer.java:468) W/System.err: at com.github.mikephil.charting.charts.BarLineChartBase.onDraw(BarLineChartBase.java:255) W/System.err: at android.view.View.draw(View.java:17071) W/System.err: at android.view.View.updateDisplayListIfDirty(View.java:16053) W/System.err: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748) W/System.err: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728) W/System.err: at android.view.View.updateDisplayListIfDirty(View.java:16016) W/System.err: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748) W/System.err: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728) W/System.err: at android.view.View.updateDisplayListIfDirty(View.java:16016) W/System.err: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748) W/System.err: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728) W/System.err: at android.view.View.updateDisplayListIfDirty(View.java:16016) W/System.err: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748) W/System.err: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728) W/System.err: at android.view.View.updateDisplayListIfDirty(View.java:16016) W/System.err: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748) W/System.err: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728) W/System.err: at android.view.View.updateDisplayListIfDirty(View.java:16016) W/System.err: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748) W/System.err: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728) W/System.err: at android.view.View.updateDisplayListIfDirty(View.java:16016) W/System.err: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748) W/System.err: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728) W/System.err: at android.view.View.updateDisplayListIfDirty(View.java:16016) W/System.err: at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:656) W/System.err: at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:662) W/System.err: at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:770) W/System.err: at android.view.ViewRootImpl.draw(ViewRootImpl.java:2796) W/System.err: at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2604) W/System.err: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2211) W/System.err: at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1246) W/System.err: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6301) W/System.err: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:871) W/System.err: at android.view.Choreographer.doCallbacks(Choreographer.java:683) W/System.err: at android.view.Choreographer.doFrame(Choreographer.java:619) W/System.err: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:857) W/System.err: at android.os.Handler.handleCallback(Handler.java:751) W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95) W/System.err: at android.os.Looper.loop(Looper.java:154) W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6077) W/System.err: at java.lang.reflect.Method.invoke(Native Method) W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Expected Behavior The whole app should not crash, and just continue working.
Possible Solution Catch the exception and don't try to highlight a Bar Chart that is not visible.