Hi,
I'm trying to find a way to set the font for the tooltips generated by my StandardXYToolTipGenerator. I can't find where to set the property. The text in the tooltips is now very big and I want it smaller.
Thanx,
Lukas
How to change font for tooltips
Like every other swing tooltip, the font and appearance are determined by the look and feel. However, every swing text component (including tooltips) supports the display of HTML. So you can specify some formatted HTML in the StandardXYToolTipGenerator.
For example, this string should work as expected for the formatString argument
For example, this string should work as expected for the formatString argument
Code: Select all
"<html><body>{0} = {2} <font size="7">{1}</font></body></html>"
OK, but my graph is not part of a swing GUI, it's displayed as a .png image in a webapplication. Is there no way to simply pass a Font object to some renderer or tooltip generator in JFreeChart?
if i do this:
the tooltip doesn't get formatted, only shows the code
if i do this:
Code: Select all
XYToolTipGenerator vasToolTipGenerator = new StandardXYToolTipGenerator("<html><body>{0} = {2} <font size=\"7\">{1}</font></body></html>", new SimpleDateFormat("yyyyMMdd HH:mm"), new DecimalFormat("#0.0"));
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Then the tooltip font is controlled by the browser displaying the image (and associated HTML image map). There's nothing (I'm aware of) that JFreeChart can do to control that.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

