MPAndroidChart icon indicating copy to clipboard operation
MPAndroidChart copied to clipboard

I have problem with getChartBitmap

Open jagarell opened this issue 6 years ago • 4 comments

I have this error: java.lang.IllegalArgumentException: width and height must be > 0 at android.graphics.Bitmap.createBitmap(Bitmap.java:1039) at android.graphics.Bitmap.createBitmap(Bitmap.java:1006) at android.graphics.Bitmap.createBitmap(Bitmap.java:956) at android.graphics.Bitmap.createBitmap(Bitmap.java:917) at com.github.mikephil.charting.charts.Chart.getChartBitmap(Chart.java:1477)

jagarell avatar Sep 17 '19 20:09 jagarell

I am also getting this error. Did you ever find a fix?

svgupta97 avatar Jun 28 '20 19:06 svgupta97

same problem here!

FDassatti avatar Mar 08 '22 11:03 FDassatti

You need to measure it by yourself:

chart.measure (View.MeasureSpec.makeMeasureSpec (300, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec (500, View.MeasureSpec.EXACTLY));
chart.layout (0, 0, chart.getMeasuredWidth (), chart.getMeasuredHeight ());

Bitmap chartBitmap = chart.getChartBitmap ();

acuna-public avatar Jul 28 '22 18:07 acuna-public

same problem here!

pokerfacecmy avatar Jun 09 '23 06:06 pokerfacecmy