Multiple fonts in the same chart title or axis label

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
SystemsEngineer
Posts: 16
Joined: Thu Jan 19, 2017 5:54 pm
antibot: No, of course not.

Multiple fonts in the same chart title or axis label

Post by SystemsEngineer » Wed Jan 25, 2017 10:13 am

Hello,

I've been trying to use am HTML wrapped string (e.g. "<html><b>Time</b> (seconds)</html>") but it seems that JFreeChart methods for setting text to chart labels (e.g. "setLabel") do not "understand" the html wrapping. Do you have any idea how I could implement this (I want generally to apply different fonts to different words of a specific string in JFreeChart)?

Thanks a lot!

John Matthews
Posts: 513
Joined: Wed Sep 12, 2007 3:18 pm

Re: Multiple fonts in the same chart title or axis label

Post by John Matthews » Wed Jan 25, 2017 12:14 pm

You may be able to use an AttributedString, seen here and discussed here.

SystemsEngineer
Posts: 16
Joined: Thu Jan 19, 2017 5:54 pm
antibot: No, of course not.

Re: Multiple fonts in the same chart title or axis label

Post by SystemsEngineer » Wed Jan 25, 2017 3:51 pm

Thank you very much for your help! It worked perfectly!

Locked