j4me / achartengine

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

NullPointerException in XYChart.toRealPoint #377

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a CombinedXYChartIntent and touch the screen
2.
3.

What is the expected output? What do you see instead?

FATAL EXCEPTION: main
java.lang.NullPointerException
at org.achartengine.chart.XYChart.toRealPoint(XYChart.java:877)
at org.achartengine.tools.Pan.apply(Pan.java:74)
at org.achartengine.TouchHandler.handleTouch(TouchHandler.java:119)

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

To simulate the problem perform the following code from any activity:
startActivity(new VolumesChart().execute(this));

Then click in the screen.
I am using the Galaxy S4 to run the program.

What version of the product binary library are you using?
1.2.2

Please provide any additional information below.
Issue 359 is closed but not fixed.

I am getting this problem with version 1.2.0.
I am using ChartFactory.getCombinedXYChartIntent with two Y axes, 2 bars, 2 
lines and 1 scatter series.
Every time I touch the screen the exception is fired.
Important observation, if I zoom down the image and turn back, the problem does 
not happen.

Thanks,
Andre

Original issue reported on code.google.com by anlug...@gmail.com on 10 Dec 2013 at 4:32

Attachments:

GoogleCodeExporter commented 9 years ago
I found the problem.
In XYChart class the size for the Map<Integer, double[]> mCalcRange is lower 
than ScaleCount from mRenderer, in this case the array returned from the method 
getCalcRange(int scale) is null.

I bypass the problem amending XYChart class using the following code in line 
877:

double[] calcRange = getCalcRange(scale);
realMinX = calcRange != null ? calcRange[0] : realMinX;
realMaxX = calcRange != null ? calcRange[1] : realMaxX;
realMinY = calcRange != null ? calcRange[2] : realMinY;
realMaxY = calcRange != null ? calcRange[3] : realMaxY;

I hope it helps others.
Cheers,
Andre

Original comment by anlug...@gmail.com on 13 Dec 2013 at 7:02

GoogleCodeExporter commented 9 years ago
Thanks.

Original comment by 4viewsoft@gmail.com on 7 Jan 2014 at 9:56