Customize ToolTip Text for TimeSeriesGraph

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
rspan
Posts: 15
Joined: Wed May 02, 2007 4:36 pm

Customize ToolTip Text for TimeSeriesGraph

Post by rspan » Wed Jun 13, 2007 11:38 pm

StandartXYToolTipGenerator always show the Key of Series as ToolTip. What about if I need to show some other text but not key? How to implement it?

Thanks.

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

Re: Customize ToolTip Text for TimeSeriesGraph

Post by RichardWest » Thu Jun 14, 2007 1:03 am

rspan wrote:StandartXYToolTipGenerator always show the Key of Series as ToolTip. What about if I need to show some other text but not key? How to implement it?
Take a look at the StandardXYToolTip JavaDoc entry (the JavaDoc is there for a reason). You will see that StandardXYToolTipGenerator implments XYToolTipGenerator interface. For a custom tool tip, create a class that implements the XYToolTipGenerator interface. There are plenty of examples if you search the forum and the source code.
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA

laurent b
Posts: 7
Joined: Fri Apr 27, 2007 5:43 am

Post by laurent b » Fri Jun 22, 2007 9:24 am

the string you will return in your generateToolTip() can be (should be ?) html formated.
I spend some time figuring why the fuc*** \n were not displayed :twisted:
before using html tags
and suddenly life was beautiful
:D

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Fri Jun 22, 2007 9:31 am

The tooltip text is displayed using Swing's tooltip mechanism. This supports some HTML - see the following:

http://java.sun.com/docs/books/tutorial ... /html.html
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked