Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » RAP & JFreeChart
RAP & JFreeChart [message #547371] Fri, 16 July 2010 09:27 Go to next message
Eclipse UserFriend
Has anybody successfully integrated the two ?


Thanks & Regards,

Setya
Re: RAP & JFreeChart [message #547647 is a reply to message #547371] Mon, 19 July 2010 05:06 Go to previous messageGo to next message
Eclipse UserFriend
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 06:05 Go to previous message
Eclipse UserFriend
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 Jul 08 06:54:47 EDT 2025

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

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

Back to the top