-
-
Notifications
You must be signed in to change notification settings - Fork 9k
v.3.0.0-beta1 BarChart: ArrayIndexOutOfBoundsException when formatter applied, granularity is enabled and there's only one data point #2153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The crash occurred in the code that you yourself wrote. The only one who can prevent this crash from happening is you yourself. When using the formatters of course you need to be aware that the value coming from the formatter might not fit any array or list you use in the formatter. Offtopic: As a personal recommendation I suggest to never simply place code into a try-catch block for preventing crashes. But this is more of a stackoverflow topic. |
Hi Phil! Thank you for your comment! |
I also meet such question,it seems label count be increased in the lib AxisRenderer.java in the function computeAxisValues,maybe we can rewrite it by self |
i just solved this problem; |
Well, I too got into the same problem, but with @PhilJay suggestion, I got a work around as follows
To the following
@PhilJay, please let me know if the above approach is OK. |
@gao746700783 I want to know how do you solve? how to reset valueFormatter |
@skh1993 I think gao means calling setValueFormatter(null) on axis. |
antohama |
@skh1993 |
The concern that @antohama has raised is genuine. Thanks much @eprabhakar , your solution did work for me |
Anyone having the issue yet? I'm facing the same problem and no suggestions above worked for me :/ |
@eprabhakar i changed your return statement from null to "" and worked for me. |
gao746700783 : How did you reset the value formatter? Could you pls share the code for that? |
Thanks to @PhilJay for this great library 👍 Thanks @eprabhakar & @antohama 👏 The below code solved the crash.
NB: But it will not plot the line graph. So for the best result add a dummy value before it and make the data list size as two. And works all perfect. |
Same issue, without line graph. |
@santhosh285 it worked.. thanks |
Good lib but it's clearly lib's bug, not integrators bug. |
Change: final ArrayList xVals = new ArrayList<>(); |
xAxis.setValueFormatter(new IAxisValueFormatter() { thanks it helped |
This works!!! Thank You! |
if you GONE the barchart then you set bardata, it can cause crash too! so, set visibility after you set bardata |
Uh oh!
There was an error while loading. Please reload this page.
Hi, I've faced an ArrayIndexOutOfBoundsException under following conditions:
Here's the stacktrace:
Simplified code:
The text was updated successfully, but these errors were encountered: