Problem with a line chart on iOS

28 views
Skip to first unread message

jam...@fastlaneinnovations.com

unread,
May 28, 2017, 7:07:17 PM5/28/17
to CodenameOne Discussions
I'm using a LineChart on iOS, and I get a null pointer exception when a point is added to the series. It seems like it happens on the first point. I've been using this feature for quite a while without issue, but builds now are not working. I also tried it with the Chart demo, by adding a class to create datapoints and feed them to the chart and it causes the exception. On my app, it will crash after the exception but on the demo it will plot points to the chart after the first one pops up the exception.

I built with sources and used XCode and a phone to run both the app and the demo, and the stack trace is the same:

2017-05-28 15:56:57.443524-0700 ChartTest[424:41670] [EDT] 0:0:0,2 - Codename One revisions: 5ad4700144e6d2d647e4bfdbed729151640d4c7f
2376
2017-05-28 15:56:57.487668-0700 ChartTest[424:41670] [EDT] 0:0:0,46 - Exception: java.lang.NullPointerException - null
2017-05-28 15:56:57.492692-0700 ChartTest[424:41670] java.lang.NullPointerException
    at com_codename1_charts_views_XYChart.draw:288
    at com_codename1_charts_ChartUtil.paintChart:53
    at com_codename1_charts_ChartComponent.paint:286
    at com_codename1_ui_Component.internalPaintImpl:1564
    at com_codename1_ui_Component.paintInternalImpl:1538
    at com_codename1_ui_Component.paintInternal:1513
    at com_codename1_ui_Container.paint:1439
    at com_codename1_ui_Component.internalPaintImpl:1564
    at com_codename1_ui_Component.paintInternalImpl:1538
    at com_codename1_ui_Component.paintInternal:1513
    at com_codename1_ui_Container.paint:1439
    at com_codename1_ui_Component.internalPaintImpl:1564
    at com_codename1_ui_Component.paintInternalImpl:1538
    at com_codename1_ui_Component.paintInternal:1513
    at com_codename1_ui_Container.paint:1439
    at com_codename1_ui_Form.paint:3256
    at com_codename1_ui_Component.internalPaintImpl:1564
    at com_codename1_ui_Form.internalPaintImpl:3266
    at com_codename1_ui_Component.paintInternalImpl:1538
    at com_codename1_ui_Component.paintInternal:1513
    at com_codename1_ui_Component.paintInternal:1481
    at com_codename1_ui_Component.paintComponent:1766
    at com_codename1_ui_Component.paintComponent:1713
    at com_codename1_impl_CodenameOneImplementation.paintDirty:596
    at com_codename1_ui_Display.edtLoopImpl:979
    at com_codename1_ui_Display.mainEDTLoop:901
    at com_codename1_ui_RunnableWrapper.run:120
    at com_codename1_impl_CodenameOneThread.run:176
    at java_lang_Thread.runImpl:153

jam...@fastlaneinnovations.com

unread,
May 28, 2017, 7:31:30 PM5/28/17
to CodenameOne Discussions, jam...@fastlaneinnovations.com
Actually, I didn't start with the demo, I made a simple chart app. Attached is the src folder.
src.zip

Shai Almog

unread,
May 29, 2017, 12:25:31 AM5/29/17
to CodenameOne Discussions, jam...@fastlaneinnovations.com
Not sure, we'll have to look into it. Can you please file an issue?

Steve Hannah

unread,
May 29, 2017, 11:34:55 AM5/29/17
to codenameone...@googlegroups.com, jam...@fastlaneinnovations.com
Rather than posting a zip file, please just share relevant snippets inside the post.
The NPE stack trace indicates that your data includes an X value with a corresponding "null" Y value.

Steve

On Sun, May 28, 2017 at 9:25 PM, Shai Almog <shai....@gmail.com> wrote:
Not sure, we'll have to look into it. Can you please file an issue?

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/ae60ec2a-ab34-4575-8149-bd0a8152e13a%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Steve Hannah
Software Developer
Codename One

jam...@fastlaneinnovations.com

unread,
May 29, 2017, 7:35:59 PM5/29/17
to CodenameOne Discussions, jam...@fastlaneinnovations.com
I should've remembered - this is the same issue I had a while back where if the first data point has an x-value of 0.0 it throws a null pointer on iOS (Android and simulator work fine). I'm pretty sure this got fixed a while back, but has come up again. I just add a small amount to the x-value to shift it off zero, or I can add a point with a very small value before the app starts plotting real data. I can file an issue for this.
Reply all
Reply to author
Forward
0 new messages