这是我的代码,
mRenderer.setXAxisMin(0);
mRenderer.setXAxisMax(38);
mRenderer.setYAxisMin(40);
mRenderer.setYAxisMax(110);
mRenderer.setPanLimits(new double[] { 0, 38, 40, 110 });
mRenderer.setZoomLimits(new double[] { 0, 38, 40, 110 });
mRenderer.setAxesColor(Color.GRAY);
mRenderer.setLabelsColor(Color.GRAY);
mRenderer.setPointSize(8);
mRenderer.setXLabels(12);
mRenderer.setYLabels(10);
mRenderer.setShowGrid(true);
mRenderer.setApplyBackgroundColor(true);
mRenderer.setXLabelsAlign(Align.RIGHT);
mRenderer.setYLabelsAlign(Align.RIGHT);
mRenderer.setZoomButtonsVisible(true);
mRenderer.setBackgroundColor(Color.BLACK);
mRenderer.setZoomRate(1.05f);
mRenderer.setLabelsColor(Color.WHITE);
mRenderer.setXLabelsColor(Color.WHITE);
mRenderer.setYLabelsColor(0, Color.BLUE);
应用程序在没有缩放的情况下表现正常,当我缩放然后开始平移时,app force关闭
平移受限制而没有缩放但是当我在缩放超出限制后平移时会导致空指针异常,
logcat结果,
03-13 12:32:05.270: E/AndroidRuntime(1716): java.lang.NullPointerException
03-13 12:32:05.270: E/AndroidRuntime(1716): at org.achartengine.tools.Pan.apply(Pan.java:66)
03-13 12:32:05.270: E/AndroidRuntime(1716): at org.achartengine.TouchHandler.handleTouch(TouchHandler.java:119)
03-13 12:32:05.270: E/AndroidRuntime(1716): at org.achartengine.GraphicalView.onTouchEvent(GraphicalView.java:300)
03-13 12:32:05.270: E/AndroidRuntime(1716): at android.view.View.dispatchTouchEvent(View.java:3885)
03-13 12:32:05.270: E/AndroidRuntime(1716): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
03-13 12:32:05.270: E/AndroidRuntime(1716): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
03-13 12:32:05.270: E/AndroidRuntime(1716): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
03-13 12:32:05.270: E/AndroidRuntime(1716): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
03-13 12:32:05.270: E/AndroidRuntime(1716): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942)
03-13 12:32:05.270: E/AndroidRuntime(1716): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1691)
03-13 12:32:05.270: E/AndroidRuntime(1716): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1125)
03-13 12:32:05.270: E/AndroidRuntime(1716): at android.app.Activity.dispatchTouchEvent(Activity.java:2096)
03-13 12:32:05.270: E/AndroidRuntime(1716): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1675)
03-13 12:32:05.270: E/AndroidRuntime(1716): at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2195)
03-13 12:32:05.270: E/AndroidRuntime(1716): at android.view.ViewRoot.handleMessage(ViewRoot.java:1879)
03-13 12:32:05.270: E/AndroidRuntime(1716): at android.os.Handler.dispatchMessage(Handler.java:99)
03-13 12:32:05.270: E/AndroidRuntime(1716): at android.os.Looper.loop(Looper.java:130)
03-13 12:32:05.270: E/AndroidRuntime(1716): at android.app.ActivityThread.main(ActivityThread.java:3683)
03-13 12:32:05.270: E/AndroidRuntime(1716): at java.lang.reflect.Method.invokeNative(Native Method)
03-13 12:32:05.270: E/AndroidRuntime(1716): at java.lang.reflect.Method.invoke(Method.java:507)
03-13 12:32:05.270: E/AndroidRuntime(1716): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-13 12:32:05.270: E/AndroidRuntime(1716): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-13 12:32:05.270: E/AndroidRuntime(1716): at dalvik.system.NativeStart.main(Native Method)
答案 0 :(得分:0)
我已将此问题发布给AChartEngine的开发人员,可以在任何时候访问以下网址来解决(或)修复该问题。