paragp / achartengine

AChartEngine is a charting library for Android applications. It currently supports the following chart types: line chart area chart scatter chart time chart bar chart pie chart bubble chart doughnut chart range (high-low) bar chart dial chart / gauge combined (any combination of line, cubic line, scatter, bar, range bar, bubble) chart cubic line chart All the above supported chart types can contain multiple series, can be displayed with the X axis horizontally (default) or vertically and support many other custom features. The charts can be built as a view that can be added to a view group or as an intent, such as it can be used to start an activity. The model and the graphing code is well optimized such as it can handle and display huge number of values. AChartEngine is currently at the 1.0.0 release. New chart types will be added in the following releases. Please keep sending your feedback such as we can continually improve this library. Find us on Facebook, too: http://www.facebook.com/achartengine Read a short introduction to AChartEngine here: http://www.javaadvent.com/2012/12/achartengine-charting-library-for.html Another good tutorial can be read here: http://jaxenter.com/effort-free-graphs-on-android-with-achartengine-46199.html
0 stars 1 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

GoogleCodeExporter commented 9 years ago

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

Attachments: