I am trying to implement a custom tooltip.
I hooked up a custom ActionRenderer.
The issue is that MyActionRenderer.processAction(...) never gets called.
public void paint( Graphics g )
{
super.paint( g );
Graphics2D g2d = (Graphics2D) g;
idr.setProperty( IDeviceRenderer.GRAPHICS_CONTEXT, g2d );
idr.setProperty( IDeviceRenderer.UPDATE_NOTIFIER, this );
Dimension d = getSize( );
Bounds bo = BoundsImpl.create( 0, 0, d.width, d.height );
bo.scale( 72d / idr.getDisplayServer( ).getDpiResolution());
Generator gr = Generator.instance( );
if ( bNeedsGeneration ) {
bNeedsGeneration = false;
try {
gcs = gr.build( idr.getDisplayServer( ),
cm,
bo,
null,
null,
null );
} catch ( ChartException ex ) {
//System.out.println( ex );
}
}
try {
gcs.getRunTimeContext().setActionRenderer(new MyActionRenderer());
gr.render( idr, gcs );
}
catch ( ChartException ex ) {
System.out.println( ex );
}
}
public class MyActionRenderer extends ActionRendererAdapter {
public void processAction(Action action, StructureSource source) {
System.out.println("Hello My Action");
if (ActionType.SHOW_TOOLTIP_LITERAL.equals(action.getType())) {
TooltipValue tv = (TooltipValue) action.getValue();
if (StructureType.SERIES_DATA_POINT.equals(source.getType())) {
final DataPointHints dph = (DataPointHints) source.getSource();
tv.setText(ChartUtil.stringValue(dph.getBaseValue() + "--" + dph.getSeriesDisplayValue() + "--" + dph.getOrthogonalDisplayValue()));
}
}
}
}
Any help would be greatly appreciated.
Thanks!