Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » RAP & JFreeChart
RAP & JFreeChart [message #547371] Fri, 16 July 2010 13:27 Go to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Has anybody successfully integrated the two ?


Thanks & Regards,

Setya
Re: RAP & JFreeChart [message #547647 is a reply to message #547371] Mon, 19 July 2010 09:06 Go to previous messageGo to next message
Benjamin Muskalla is currently offline Benjamin MuskallaFriend
Messages: 338
Registered: July 2009
Senior Member
Hi Setya,

as far as I know, JFreeChart can render the charts to an image file.
This can be used as Image for a Label for something similar. See the
BIRT integration tutorial which has an example of how to use it.
And it would be awesome to write a FAQ entry about integrating
JFreeChart into RAP.

Regards,
Ben

Setya wrote:
> Has anybody successfully integrated the two ?
>
>
> Thanks & Regards,
>
> Setya


--
Benjamin Muskalla | EclipseSource Karlsruhe
http://www.eclipsesource.com | http://twitter.com/eclipsesource
Re: RAP & JFreeChart [message #547666 is a reply to message #547647] Mon, 19 July 2010 10:05 Go to previous message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Hi Benjamin,

Thank you for your response.

I've managed to use JFreeChart in Label widget without using image file
at all.

Here's my simplified code in case if anyone needs it :

....
Label label = new Label(parent,SWT.NONE);
Image image = null;

JFreeChart chart = ChartFactory.createBarChart("Bar Chart", null, null,
new DefaultCategoryDataset(), PlotOrientation.VERTICAL, true, true, false);

ByteArrayOutputStream bos = new ByteArrayOutputStream();
ByteArrayInputStream bis = null;

try
{
ChartUtilities.writeChartAsPNG(bos, chart, 300, 300);

image = new Image(Display.getCurrent(), bis = new
ByteArrayInputStream(bos.toByteArray()));

label.setImage(image);
}
catch (IOException e)
{
e.printStackTrace();
}
finally
{
try {bos.close();}
catch (IOException e){}

if (bis != null)
{
try {bis.close();}
catch (IOException e){}
}
}
....


The above code lacks routine to dispose image which I've put it on
somewhere else.


Thanks & Regards,

Setya


> Hi Setya,
>
> as far as I know, JFreeChart can render the charts to an image file.
> This can be used as Image for a Label for something similar. See the
> BIRT integration tutorial which has an example of how to use it.
> And it would be awesome to write a FAQ entry about integrating
> JFreeChart into RAP.
>
> Regards,
> Ben
>
> Setya wrote:
>> Has anybody successfully integrated the two ?
>>
>>
>> Thanks & Regards,
>>
>> Setya
>
>
Previous Topic:[menu] menu contributions not updated/shown if they have a visibleWhen expression
Next Topic:Accessing qooxdoo-function from iframe
Goto Forum:
  


Current Time: Tue Apr 23 08:57:48 GMT 2024

Powered by FUDForum. Page generated in 0.03235 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top