Using Chart Engine for Browser output [message #145784] |
Sat, 18 March 2006 09:30 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: diptendu.vsnl.com
The Chart Engine examples that come with BIRT download talk about SWING or
SWT renderers. We want to use simple image renderers such as JPEG or PNG
to be generated from Servlets with the data coming from MySQL. Are
examples for such a scenario available?
Regards,
Diptendu Dutta
|
|
|
Re: Using Chart Engine for Browser output [message #145827 is a reply to message #145784] |
Mon, 20 March 2006 03:49 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Zhiqiang Qian![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=zqian%40actuate.com) Messages: 76 Registered: July 2009 |
Member |
|
|
Hi Diptendu,
Yes, you can use JpegRenderer and PngRenderer as well. Here is a simple
example:
============================================================ ============
IDeviceRenderer idr = PluginSettings.instance( ) .getDevice( "dv.PNG"
); //$NON-NLS-1$
final Bounds bo = BoundsImpl.create( 0, 0, width, height );
RunTimeContext rtc = new RunTimeContext( );
rtc.setLocale( Locale.getDefault( ) );
final Generator gr = Generator.instance( );
GeneratedChartState gcs = null;
gcs = gr.build( idr.getDisplayServer( ), cm, null, bo, rtc );
final BufferedImage bi = new BufferedImage( (int) bo.getWidth( ), (int)
bo.getHeight( ), BufferedImage.TYPE_INT_ARGB );
idr.setProperty( IDeviceRenderer.GRAPHICS_CONTEXT, bi.getGraphics( ) );
// if you want a file output.
idr.setProperty( IDeviceRenderer.FILE_IDENTIFIER, "c:/test.png" );
// if you just want an in-memory image output.
idr.setProperty( IDeviceRenderer.CACHED_IMAGE, bi );
gr.render( idr, gcs );
============================================================ ============
Hope this helps.
Zhiqiang Qian
Diptendu Dutta wrote:
> The Chart Engine examples that come with BIRT download talk about SWING
> or SWT renderers. We want to use simple image renderers such as JPEG or
> PNG to be generated from Servlets with the data coming from MySQL. Are
> examples for such a scenario available?
>
> Regards,
>
> Diptendu Dutta
>
|
|
|
Powered by
FUDForum. Page generated in 0.03461 seconds