Home » Archived » BIRT » Eclipse Chart Engine, PNG, and ImageMap
Eclipse Chart Engine, PNG, and ImageMap [message #186425] |
Mon, 21 August 2006 13:02  |
Eclipse User |
|
|
|
Originally posted by: molson.airinc.com
Hi, I am having a problem creating an imagemap for a chart I have
created. I am able to create a PNG image just fine and have it display
in a browser, however the imagemap I get is always null.
When I create my chart, I add triggers to my bar series like so:
bsY11.getTriggers( ).add(
TriggerImpl.create(
TriggerCondition.ONMOUSEOVER_LITERAL,
ActionImpl.create(
ActionType.SHOW_TOOLTIP_LITERAL,
TooltipValueImpl.create( 500, "my label" )
)
)
);
I then have a servlet to create the png image. That works fine, but my
image map is being returned as null.
here is the interesting part of my get ( cm is the chart ):
IDeviceRenderer idr = null;
final PluginSettings ps = PluginSettings.instance( );
try
{
idr = ps.getDevice( "dv.PNG" );
}
catch ( ChartException ex )
{
ex.printStackTrace( );
}
// Create a buffered image
BufferedImage image = new BufferedImage( width,
height,
BufferedImage.TYPE_INT_ARGB );
// Draw the chart in the buffered image
Graphics2D g2d = (Graphics2D) image.getGraphics( );
idr.setProperty( IDeviceRenderer.GRAPHICS_CONTEXT, g2d );
Bounds bo = BoundsImpl.create( 0, 0, width, height );
bo.scale( 72d / idr.getDisplayServer( ).getDpiResolution( ) );
Generator gr = Generator.instance( );
try
{
idr.setProperty( IDeviceRenderer.CACHED_IMAGE, image );
gr.render( idr, gr.build( idr.getDisplayServer( ),
cm,
bo,
null,
null,
null ) );
}
catch ( ChartException ex )
{
ex.printStackTrace( );
}
g2d.dispose( );
IImageMapEmitter test = (IImageMapEmitter)idr;
String vals = test.getImageMap();
....
vals is null, despite the fact that I know there are triggers set up for
the bar series in the chart. Any idea why?
Cheer,
Mike
|
|
|
Re: Eclipse Chart Engine, PNG, and ImageMap [message #186433 is a reply to message #186425] |
Mon, 21 August 2006 13:20   |
Eclipse User |
|
|
|
Originally posted by: remberson.edgedynamics.com
molson wrote:
> Hi, I am having a problem creating an imagemap for a chart I have
> created. I am able to create a PNG image just fine and have it display
> in a browser, however the imagemap I get is always null.
>
> When I create my chart, I add triggers to my bar series like so:
>
> bsY11.getTriggers( ).add(
> TriggerImpl.create(
> TriggerCondition.ONMOUSEOVER_LITERAL,
> ActionImpl.create(
> ActionType.SHOW_TOOLTIP_LITERAL,
> TooltipValueImpl.create( 500, "my label" )
> )
> )
> );
>
>
> I then have a servlet to create the png image. That works fine, but my
> image map is being returned as null.
>
> here is the interesting part of my get ( cm is the chart ):
>
> IDeviceRenderer idr = null;
> final PluginSettings ps = PluginSettings.instance( );
> try
> {
> idr = ps.getDevice( "dv.PNG" );
> }
> catch ( ChartException ex )
> {
> ex.printStackTrace( );
> }
>
> // Create a buffered image
> BufferedImage image = new BufferedImage( width,
> height,
> BufferedImage.TYPE_INT_ARGB );
>
> // Draw the chart in the buffered image
> Graphics2D g2d = (Graphics2D) image.getGraphics( );
> idr.setProperty( IDeviceRenderer.GRAPHICS_CONTEXT, g2d );
>
> Bounds bo = BoundsImpl.create( 0, 0, width, height );
> bo.scale( 72d / idr.getDisplayServer( ).getDpiResolution( ) );
>
> Generator gr = Generator.instance( );
>
> try
> {
> idr.setProperty( IDeviceRenderer.CACHED_IMAGE, image );
> gr.render( idr, gr.build( idr.getDisplayServer( ),
> cm,
> bo,
> null,
> null,
> null ) );
> }
> catch ( ChartException ex )
> {
> ex.printStackTrace( );
> }
>
> g2d.dispose( );
>
> IImageMapEmitter test = (IImageMapEmitter)idr;
> String vals = test.getImageMap();
>
> ...
>
>
>
> vals is null, despite the fact that I know there are triggers set up for
> the bar series in the chart. Any idea why?
>
> Cheer,
> Mike
|
|
| |
Re: Eclipse Chart Engine, PNG, and ImageMap [message #186516 is a reply to message #186425] |
Tue, 22 August 2006 04:25   |
Eclipse User |
|
|
|
try add this before you call gr.render(),
idr.setProperty( IDeviceRenderer.UPDATE_NOTIFIER,
new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );
gcs is the return value of gr.build().
molson wrote:
> Hi, I am having a problem creating an imagemap for a chart I have
> created. I am able to create a PNG image just fine and have it display
> in a browser, however the imagemap I get is always null.
>
> When I create my chart, I add triggers to my bar series like so:
>
> bsY11.getTriggers( ).add(
> TriggerImpl.create(
> TriggerCondition.ONMOUSEOVER_LITERAL,
> ActionImpl.create(
> ActionType.SHOW_TOOLTIP_LITERAL,
> TooltipValueImpl.create( 500, "my label" )
> )
> )
> );
>
>
> I then have a servlet to create the png image. That works fine, but my
> image map is being returned as null.
>
> here is the interesting part of my get ( cm is the chart ):
>
> IDeviceRenderer idr = null;
> final PluginSettings ps = PluginSettings.instance( );
> try
> {
> idr = ps.getDevice( "dv.PNG" );
> }
> catch ( ChartException ex )
> {
> ex.printStackTrace( );
> }
>
> // Create a buffered image
> BufferedImage image = new BufferedImage( width,
> height,
> BufferedImage.TYPE_INT_ARGB );
>
> // Draw the chart in the buffered image
> Graphics2D g2d = (Graphics2D) image.getGraphics( );
> idr.setProperty( IDeviceRenderer.GRAPHICS_CONTEXT, g2d );
>
> Bounds bo = BoundsImpl.create( 0, 0, width, height );
> bo.scale( 72d / idr.getDisplayServer( ).getDpiResolution( ) );
>
> Generator gr = Generator.instance( );
>
> try
> {
> idr.setProperty( IDeviceRenderer.CACHED_IMAGE, image );
> gr.render( idr, gr.build( idr.getDisplayServer( ),
> cm,
> bo,
> null,
> null,
> null ) );
> }
> catch ( ChartException ex )
> {
> ex.printStackTrace( );
> }
>
> g2d.dispose( );
>
> IImageMapEmitter test = (IImageMapEmitter)idr;
> String vals = test.getImageMap();
>
> ...
>
>
>
> vals is null, despite the fact that I know there are triggers set up for
> the bar series in the chart. Any idea why?
>
> Cheer,
> Mike
|
|
|
Re: Eclipse Chart Engine, PNG, and ImageMap [message #186796 is a reply to message #186516] |
Thu, 24 August 2006 10:55  |
Eclipse User |
|
|
|
Originally posted by: molson.airinc.com
This works great foir ONMOUSEOVER_LITERAL triggers, however, when I use
ONMOUSEDOWN_LITERAL, my imagemap is an empty string. Shouldn't imagemap
support mousedown?
Here is my trigger code
bsY11.getTriggers( ).add(
TriggerImpl.create(
TriggerCondition.ONMOUSEDOWN_LITERAL,
ActionImpl.create(
ActionType.URL_REDIRECT_LITERAL,
URLValueImpl.create( "http://www.actuate.com", null, null, null, null )
)
)
);
Any ideas?
Zhiqiang Qian wrote:
> try add this before you call gr.render(),
>
> idr.setProperty( IDeviceRenderer.UPDATE_NOTIFIER,
> new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );
>
> gcs is the return value of gr.build().
>
> molson wrote:
>
>> Hi, I am having a problem creating an imagemap for a chart I have
>> created. I am able to create a PNG image just fine and have it
>> display in a browser, however the imagemap I get is always null.
>>
>> When I create my chart, I add triggers to my bar series like so:
>>
>> bsY11.getTriggers( ).add(
>> TriggerImpl.create(
>> TriggerCondition.ONMOUSEOVER_LITERAL,
>> ActionImpl.create(
>> ActionType.SHOW_TOOLTIP_LITERAL,
>> TooltipValueImpl.create( 500, "my label" )
>> )
>> )
>> );
>>
>>
>> I then have a servlet to create the png image. That works fine, but
>> my image map is being returned as null.
>>
>> here is the interesting part of my get ( cm is the chart ):
>>
>> IDeviceRenderer idr = null;
>> final PluginSettings ps = PluginSettings.instance( );
>> try
>> {
>> idr = ps.getDevice( "dv.PNG" );
>> }
>> catch ( ChartException ex )
>> {
>> ex.printStackTrace( );
>> }
>>
>> // Create a buffered image
>> BufferedImage image = new BufferedImage( width,
>> height,
>> BufferedImage.TYPE_INT_ARGB );
>>
>> // Draw the chart in the buffered image
>> Graphics2D g2d = (Graphics2D) image.getGraphics( );
>> idr.setProperty( IDeviceRenderer.GRAPHICS_CONTEXT, g2d );
>>
>> Bounds bo = BoundsImpl.create( 0, 0, width, height );
>> bo.scale( 72d / idr.getDisplayServer( ).getDpiResolution( ) );
>>
>> Generator gr = Generator.instance( );
>>
>> try
>> {
>> idr.setProperty( IDeviceRenderer.CACHED_IMAGE, image );
>> gr.render( idr, gr.build( idr.getDisplayServer( ),
>> cm,
>> bo,
>> null,
>> null,
>> null ) );
>> }
>> catch ( ChartException ex )
>> {
>> ex.printStackTrace( );
>> }
>> g2d.dispose( );
>> IImageMapEmitter test = (IImageMapEmitter)idr;
>> String vals = test.getImageMap();
>>
>> ...
>>
>>
>>
>> vals is null, despite the fact that I know there are triggers set up
>> for the bar series in the chart. Any idea why?
>>
>> Cheer,
>> Mike
|
|
|
Goto Forum:
Current Time: Fri Jul 11 08:25:40 EDT 2025
Powered by FUDForum. Page generated in 0.26362 seconds
|