PhilJay / MPAndroidChart

A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.
Other
37.53k stars 9.01k forks source link

I have problem with getChartBitmap #4664

Open jagarell opened 4 years ago

jagarell commented 4 years ago

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)

svgupta97 commented 4 years ago

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

FDassatti commented 2 years ago

same problem here!

acuna-public commented 2 years ago

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 ();
pokerfaceCmy commented 1 year ago

same problem here!