ibrahimsaputra / achartengine

Automatically exported from code.google.com/p/achartengine
0 stars 0 forks source link

Chart to Bitmap #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Is it possible to convert a chart to a bitmap file? It would be very helpful!

Thanks.

Original issue reported on code.google.com by outi1...@googlemail.com on 4 Jan 2011 at 7:59

GoogleCodeExporter commented 9 years ago
you can save the view as a bitmap:
if( false == view.isDrawingCacheEnabled()){
   view.setDrawingCacheEnabled(true);
}
Bitmap bitmap = content.getDrawingCache();

Original comment by zouxis...@gmail.com on 21 Apr 2011 at 8:29

GoogleCodeExporter commented 9 years ago
Can you provide an example of this ? , I can't see how I can access the bitmap 
without doing a custom mod of achartengine

Original comment by chris.fo...@gmail.com on 18 May 2011 at 9:58

GoogleCodeExporter commented 9 years ago
Fixed in SVN rev. r188.
Added GraphicalView.toBitmap()

Original comment by dandrome...@gmail.com on 19 May 2011 at 5:34

GoogleCodeExporter commented 9 years ago
I am not able to save pie chart as bitmap then to image file.
Can you help?

here is may code
GraphicalView gview = execute(this);
if (false == gview.isDrawingCacheEnabled()) {
    gview.setDrawingCacheEnabled(true);         
}

Bitmap img = gview.getDrawingCache(); //gets NULL !!!

try {
    FileOutputStream out = new FileOutputStream(getApplicationContext().getFilesDir() + "/pie.jpeg");
    img.compress(Bitmap.CompressFormat.JPEG, 97, out);
    out.close();
} catch (Exception e) {
e.printStackTrace();
}

public GraphicalView execute(Context context) {
double[] values = new double[] { 12, 14, 11, 10, 19 };
int[] colors = new int[] { Color.BLUE, Color.GREEN, Color.MAGENTA, 
Color.YELLOW, Color.CYAN };
DefaultRenderer renderer = buildCategoryRenderer(colors);
renderer.setLabelsTextSize(14);
GraphicalView gview = ChartFactory.getPieChartView(context, 
buildCategoryDataset("Project budget", values), renderer);
return gview;
}

Original comment by abhi007t...@gmail.com on 29 Jun 2011 at 11:58

GoogleCodeExporter commented 9 years ago
Did you add the needed permission for that?

Original comment by 4viewsoft@gmail.com on 29 Jun 2011 at 3:46