Hello,
Is it possible to change the font of a chart tool tip (of a series or a legend)?
Thanks a lot!
Change tool tip font
-
- Posts: 16
- Joined: Thu Jan 19, 2017 5:54 pm
- antibot: No, of course not.
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
Re: Change tool tip font
JFreeChart uses Swing tooltips. The font is specified by the JToolTip UI delegate, typically a subclass of BasicToolTipUI. Use the UIManager, as shown here, to change the relevant property, which has the key "ToolTip.font".
-
- Posts: 16
- Joined: Thu Jan 19, 2017 5:54 pm
- antibot: No, of course not.
Re: Change tool tip font
Thank you very much for your response.
I tried to change the global UI font for the tooltips doing something like
UIManager.put("ToolTip.font", new FontUIResource("SansSerif", Font.BOLD, 28));
but the tooltips remained unaffected.
However, it seems that, when used within a JavaFX app, the JFreeChart's tooltip behavior depends on the tooltip configuration of the app and not the Swing UI because as soon as I modified the global font of the JavaFX tooltip, the problem was solved!
I tried to change the global UI font for the tooltips doing something like
UIManager.put("ToolTip.font", new FontUIResource("SansSerif", Font.BOLD, 28));
but the tooltips remained unaffected.
However, it seems that, when used within a JavaFX app, the JFreeChart's tooltip behavior depends on the tooltip configuration of the app and not the Swing UI because as soon as I modified the global font of the JavaFX tooltip, the problem was solved!
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
Re: Change tool tip font
Thank you for the followup. It would seem that ChartPanel uses Swing Tooltips, while ChartViewer uses JavaFX tooltips.
Under Swing, it's important to make any UIManager changes on the initial thread, before starting the EventQueue.
Under Swing, it's important to make any UIManager changes on the initial thread, before starting the EventQueue.
Re: Change tool tip font
Thank for tips. I've thinking how to change tool font from a while.