IsoSurface空指针异常

时间:2013-07-31 18:31:26

标签: java android teechart

我有大量数据要添加到Android中的Surface图表中。图表显示正确。但是,当我尝试将图表类型切换为IsoSurface时,应用程序崩溃。我不知道为什么它会崩溃,因为它似乎在图书馆本身。我已经包含崩溃的LogCat的输出

E/AndroidRuntime(3719): FATAL EXCEPTION: main
E/AndroidRuntime(3719): java.lang.NullPointerException
E/AndroidRuntime(3719):     at com.steema.teechart.drawing.Graphics3D.calc3DPos(Graphics3D.java:1110)
E/AndroidRuntime(3719):     at com.steema.teechart.styles.IsoSurface.loopLevels(IsoSurface.java:445)
E/AndroidRuntime(3719):     at com.steema.teechart.styles.IsoSurface.drawCell(IsoSurface.java:385)
E/AndroidRuntime(3719):     at com.steema.teechart.styles.Surface.drawAllCells(Surface.java:405)
E/AndroidRuntime(3719):     at com.steema.teechart.styles.Surface.draw(Surface.java:308)
E/AndroidRuntime(3719):     at com.steema.teechart.styles.IsoSurface.draw(IsoSurface.java:113)
E/AndroidRuntime(3719):     at com.steema.teechart.styles.Series.drawSeries(Series.java:2357)
E/AndroidRuntime(3719):     at com.steema.teechart.Chart.drawAllSeries(Chart.java:790)
E/AndroidRuntime(3719):     at com.steema.teechart.Chart.drawAxesSeries(Chart.java:752)
E/AndroidRuntime(3719):     at com.steema.teechart.Chart.internalDraw(Chart.java:732)
E/AndroidRuntime(3719):     at com.steema.teechart.Chart.paint(Chart.java:2080)
E/AndroidRuntime(3719):     at com.steema.teechart.Chart.paint(Chart.java:2096)
E/AndroidRuntime(3719):     at com.steema.teechart.TChart.onDraw(TChart.java:317)

1 个答案:

答案 0 :(得分:1)

我可以毫无错误地执行此操作:

Surface surf1 = new Surface(tChart1.getChart());
surf1.fillSampleValues();

try {
    Surface.changeType(surf1, IsoSurface.class);
} catch (IllegalArgumentException e) {
    e.printStackTrace();
} catch (InstantiationException e) {
    e.printStackTrace();
} catch (IllegalAccessException e) {
    e.printStackTrace();
} catch (NoSuchMethodException e) {
    e.printStackTrace();
} catch (InvocationTargetException e) {
    e.printStackTrace();
}

请发布一些代码,以便我们在这里重现问题。