whitespace COMPANY whitespace SERVICES whitespace PRODUCTS whitespace PURCHASE whitespace SUPPORT whitespace CONTACTS whitespace Home whitespace Contact Us whitespace Site Map whitespace
whitespace
SUPPORT
whitespace
FORUM
whitespace
FAQS
whitespace
SUBSCRIPTION
whitespace
REQUEST ON-LINE
whitespace
whitespace

Technical Support Forum

Welcome Guest Search | Active Topics | Log In | Register

Generate picture from chart Options · View
BeratAktuna
#1 Posted : Monday, November 19, 2012 5:18:06 PM
Rank: Newbie

Groups: Registered

Joined: 11/19/2012
Posts: 3
Location: Germany
We want to generate a pdf and try to integrate some charts in it.
One way would be over making pictures of the charts and put them easily in the pdf.

Is there a way to make image files with aicharts?

Thanks for the help!
Baydalka Volodymyr
#2 Posted : Thursday, November 22, 2012 11:36:31 AM
Rank: Developers Team


Groups: Registered, Administrators

Joined: 7/28/2009
Posts: 447
Hi,

Please check ChartView.getChart().save(Bitmap, boolean) method.

Best regards,
Volodymyr Baydalka
Andriod development and support team
BeratAktuna
#3 Posted : Wednesday, January 23, 2013 4:56:20 PM
Rank: Newbie

Groups: Registered

Joined: 11/19/2012
Posts: 3
Location: Germany
Thanks for the reply.
Unfortunately i need further help.

For the Pdf i need a inputstream and use the outputstream save method what should work so far.

But i have problems with generating the ChartView in my generator dynamically without xml file.
The generator is a static class, the context i tried to give through to the ChartView was the activity where i generate the pdf. But that didnt work. The ChartView object is "null".

What Context do i have to give the ChartView new() ?
And do i need to set the Chart type or anything else when i generate it without an xml file?

A example would be awesome!!!

++++++++++++++++ Here a part of my code ++++++++++++++++++++++++

ChartView oChartView = ChartGenerator.generateTCO(oProj,context);

ByteArrayOutputStream outputstream = new ByteArrayOutputStream();
oChartView.getChart().save(outputstream);
ByteArrayInputStream inputstream = new ByteArrayInputStream(outputstream.toByteArray());

//For the pdf...
Image image1 = new Image(pdf, inputstream, ImageType.PNG);

+++++++++++++++++++++++++++++++++ in the chart generator:
public static ChartView generateTCO(Project oProj, Context context){

ChartView chartView = new ChartView(context);

ChartArea area = new ChartArea();
chartView.getAreas().add(area);

ChartSeries series1 = new ChartSeries("Invest", ChartTypes.StackedColumn);

chartView.getSeries().add(series1);

chartView.getLegends().clear();
ChartLegend legend = new ChartLegend();
legend.setItemsProvider(new LegendItemsProvider.SeriesItemsProvider());
chartView.getLegends().add(legend);

++++++++++++++++++++++++++++++++++... further chart generation

Thank you!
Baydalka Volodymyr
#4 Posted : Monday, January 28, 2013 11:48:15 AM
Rank: Developers Team


Groups: Registered, Administrators

Joined: 7/28/2009
Posts: 447
Hi,

You don't need Context or ChartView if you need generate image. You may use ChartEngine. ChartView just duplicates ChartEngine methods.

Best regards,

P.S. Don't forget to set CharTEngine.setBounds() before draw it.
Volodymyr Baydalka
Andriod development and support team
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Company | Services | Practices | Technologies | Career | Contacts | Privacy
© 2005-2016 ArtfulBits. All rights reserved.