Skip to content
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

ArrayIndexOutOfBoundsException on line chart #66

Closed
jaichandra opened this issue Jan 30, 2015 · 4 comments
Closed

ArrayIndexOutOfBoundsException on line chart #66

jaichandra opened this issue Jan 30, 2015 · 4 comments

Comments

@jaichandra
Copy link

I get this error on zooming and scrolling the linechart. This happens intermittently.

java.lang.ArrayIndexOutOfBoundsException: src.length=69 srcPos=0 dst.length=32 dstPos=-37 length=69
at java.lang.System.arraycopy(Native Method)
at lecho.lib.hellocharts.formatter.ValueFormatterHelper.formatFloatValueWithPrependedAndAppendedText(ValueFormatterHelper.java:79)
at lecho.lib.hellocharts.formatter.ValueFormatterHelper.formatFloatValueWithPrependedAndAppendedText(ValueFormatterHelper.java:94)
at lecho.lib.hellocharts.formatter.SimpleAxisValueFormatter.formatValueForManualAxis(SimpleAxisValueFormatter.java:20)
at lecho.lib.hellocharts.renderer.AxesRenderer.drawAxisLabelsAndName(AxesRenderer.java:575)
at lecho.lib.hellocharts.renderer.AxesRenderer.drawInForeground(AxesRenderer.java:385)
at lecho.lib.hellocharts.view.AbstractChartView.onDraw(AbstractChartView.java:93)

@lecho
Copy link
Owner

lecho commented Jan 30, 2015

Labels can have up to 32 characters, do you have labels with more chars?

@jaichandra
Copy link
Author

No. I don't. But they are in the format of MM-DD-YY strings

@lecho
Copy link
Owner

lecho commented Jan 30, 2015

Exception is thrown in this line ValueFormatterHelper.java#L79

System.arraycopy(label, 0, formattedValue, formattedValue.length - label.length, label.length);

Where label is char array from AxisValue and formattedValue is char array with size 32.

Error message
src.length=69 srcPos=0 dst.length=32 dstPos=-37 length=69
means that label(src) has size 69 and formattetValue(dsc) has size 32 so there is invalid offset by -37(32-69) positions.

Is there any possibility that any of your formatted labels in MM-DD-YY have some additional chars, can you display them all in logcat?

@jaichandra
Copy link
Author

Yes.. looks like that was the problem. When I was formatting dates in MM-DD-YY format, seems like moment.js is throwing an exception and creating an exception string in place of the formatted value. Got it working now after fixing labels.

Thanks a ton.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants