yunjianwu / achartengine

Automatically exported from code.google.com/p/achartengine
0 stars 0 forks source link

calculateDrawPoints calculating NaN values and causes ANR on 2.3.7 #429

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I'm using a TimeChart / TimeSeries to crete a chart
2. When zooming or panning the chart, the app freezes and causes an ANR

What is the expected output? What do you see instead?
Expected zoom and pan without freezing.

Please provide a source code snippet that we can use to replicate the
issue.

After some research I found the location in the achartengine sources where the 
ANR comes from:

1.
AbstractChart.drawPath(Canvas canvas, List<Float> points, Paint paint, boolean 
circular)

The values for points: 
[-0.45539364, 104.611725, 90.916336, 94.49535, 182.28807, 80.63219, 273.6598, 
60.467575, 365.03152, -30.273169, 365.03152, 28.441431, 465.136, 604.91205]

2.
calculateDrawPoints(..)
this method is calculating NaN values that causes the method call 
"canvas.drawPath(path, paint)" in AbstractChart.drawPath() not to respond and 
creating an ANR.

This is because the value 365.03152 appears 2 times in the List of points.

I've attached screenshots showing the debugger at this method. Also an extract 
of the traces from the ANR is attached.

What version of the product binary library are you using?
Both with 1.1.0 and 1.2.0 the issue appears

Please provide any additional information below.
My Device is a HTC Desire with CyanogenMod 7.2.0.1 and Android version 2.3.7
A similar issue is described here: 
https://code.google.com/p/achartengine/issues/detail?id=322#c10

Original issue reported on code.google.com by thadde...@gmail.com on 19 Aug 2014 at 1:40

Attachments:

GoogleCodeExporter commented 9 years ago
I logged the data I'm using:
blue chart:
Fri Aug 08 14:23:28 MEZ 2014 - 2.021276595744681
Sat Aug 09 14:23:28 MEZ 2014 - 2.0238095238095237
Sun Aug 10 14:23:28 MEZ 2014 - 2.027027027027027
Mon Aug 11 14:23:28 MEZ 2014 - 2.03125
Tue Aug 12 14:23:28 MEZ 2014 - 2.037037037037037
Wed Aug 13 14:23:28 MEZ 2014 - 2.0454545454545454
Thu Aug 14 14:23:28 MEZ 2014 - 2.0833333333333335
Thu Aug 14 14:23:28 MEZ 2014 - 2.0588235294117645
Fri Aug 15 16:41:06 MEZ 2014 - 1.8181818181818181
Sat Aug 16 16:41:45 MEZ 2014 - 2.0
Sun Aug 17 16:41:53 MEZ 2014 - 1.9047619047619047

green chart:
Fri Aug 08 14:23:28 MEZ 2014 - 2.004632301341967
Sun Aug 17 16:41:53 MEZ 2014 - 2.004632301341967

Attachment contains 2 screenshots of the app:
The first shows the initial state when the chart is created.
The second shows after pressing + on the zoom buttons. In this state the chart 
can still be panned.
Now whenn pressing + on the zoom buttons the app freezes. Also happens often 
when the chart is panned outside the chart area.

Original comment by thadde...@gmail.com on 19 Aug 2014 at 2:05

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by thadde...@gmail.com on 19 Aug 2014 at 2:06

Attachments: