Using Chart Engine for Browser output [message #145784] |
Sat, 18 March 2006 04:30  |
Eclipse User |
|
|
|
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] |
Sun, 19 March 2006 22:49  |
Eclipse User |
|
|
|
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.01959 seconds