shannah / CN1aChartEngine

A port of Android aChartEngine Library for Codename One
7 stars 6 forks source link

CN1aChartEngine: zero width/height #1

Closed ivanilavsky closed 10 years ago

ivanilavsky commented 10 years ago

Hi Steve, I have problem with pie chart, when a value from series is less than 1%. In that case zero width or height is calculated for graphic component. Chart hangs on "Building chart ..." and in background exception is thrown: [Task Thread] 0:0:2,905 - java.lang.IllegalArgumentException: Width (0) and height (84) cannot be <= 0 java.lang.IllegalArgumentException: Width (0) and height (84) cannot be <= 0 at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1016) at java.awt.image.BufferedImage.(BufferedImage.java:338) at com.codename1.impl.javase.JavaSEPort.createTrackableBufferedImage(JavaSEPort.java:2869) at com.codename1.impl.javase.JavaSEPort.createTrackableBufferedImage(JavaSEPort.java:2852) at com.codename1.impl.javase.JavaSEPort.createImage(JavaSEPort.java:2877) at com.codename1.ui.Image.createImage(Image.java:566) at pisces.Graphics.toImage(Graphics.java:98) at org.achartengine.compat.Canvas.drawPath(Canvas.java:241) at org.achartengine.compat.Canvas.drawArc(Canvas.java:392) at org.achartengine.chart.PieChart.draw(PieChart.java:132) at org.achartengine.GraphicalView.onDraw(GraphicalView.java:195) at org.achartengine.compat.View$Peer.run(View.java:204) at com.codename1.ui.Display$1.run(Display.java:741) at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)

shannah commented 10 years ago

Thanks. Should be fixed now. https://github.com/shannah/CN1aChartEngine/commit/b0e45a04226cfba38f4617147277ab8ffac1eb0f

Download the latest CN1aChartEngine.cn1lib