Tool Tip Examples

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
superfield
Posts: 26
Joined: Thu Jun 07, 2007 10:07 pm

Tool Tip Examples

Post by superfield » Thu Jun 28, 2007 10:42 pm

Hi, I want to use custom tool tips and I've read what is in the devepolers guide and the API and I went through the demos, but I don't see any examples. Does anyone know if there are any examples in the source code? I want to use tool tips on an XYLineChart. If anyone has any examples of this that would be great (I barely know where to start).

RichardWest
Posts: 844
Joined: Fri Oct 13, 2006 9:29 pm
Location: Sunnyvale, CA

Post by RichardWest » Fri Jun 29, 2007 12:06 am

I don't have an example onhand, but here are the steps:

1. Create a class that implements the XYToolTipGenerator interface which returns your custom tool tip (see the source code for StandardXYToolTipGenerator for an example)
2. Use setBaseToolTipGenerator() to set the tool tip generator for the plot's renderer. Either you will create the renderer and add it to the plot or get the preexisting renderer from the plot.

Hope that gets your started.
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA

superfield
Posts: 26
Joined: Thu Jun 07, 2007 10:07 pm

Post by superfield » Fri Jun 29, 2007 3:34 pm

thanks a lot, worked like a 9 to 5! I must be learning because I knocked that out in about 10 minutes!

Locked