Here is a picture of my chart rendered in a ChartPanel using JFreeChart 1.0.10 on the left, and 1.0.11 on the right. The two charts were drawn using exactly the same code, only with different JFreeChart jar files.
All of the 1.0.11 fonts (right) are smaller than they were using 1.0.10 (left). For example, in the upper-left corner of the chart, there is a TextTitle that uses Helvetica,PLAIN,16. This looks rather bold in the older version, compared to the newer version.
Is this font size difference expected? Needless to say, I liked them the way they were. :-)
I see that the font sizes in the PDF versions of the files are still the same.
If I change the fonts to BOLD or increase the size, they look wrong in the PDF.
I am using Windows and JDK 6. Thanks for any suggestions!
--Andrew Mickish
Fonts changed from 1.0.10 to 1.0.11
Code: Select all
ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
Restoring the legacy theme was the first thing I tried, but it does not make a difference.
I am specifically setting the TextTitle fonts, the axis fonts, and pretty much every font in the chart to particular font objects, passing new Font("Times", Font.BOLD, 8) as an argument in the TextTitle constructor.
Would a theme override those specific font requests?
I am specifically setting the TextTitle fonts, the axis fonts, and pretty much every font in the chart to particular font objects, passing new Font("Times", Font.BOLD, 8) as an argument in the TextTitle constructor.
Would a theme override those specific font requests?
SOLVED
The problem was the change in the ChartPanel drawing dimensions from from 1.0.10:
to 1.0.11:
My fonts looked bigger in 1.0.10 because the whole image was being scaled larger.
Do you think those comments should be changed to "above which" ?
Code: Select all
/** The default limit below which chart scaling kicks in. */
public static final int DEFAULT_MAXIMUM_DRAW_WIDTH = 800;
/** The default limit below which chart scaling kicks in. */
public static final int DEFAULT_MAXIMUM_DRAW_HEIGHT = 600;
Code: Select all
/** The default limit below which chart scaling kicks in. */
public static final int DEFAULT_MAXIMUM_DRAW_WIDTH = 1024;
/** The default limit below which chart scaling kicks in. */
public static final int DEFAULT_MAXIMUM_DRAW_HEIGHT = 768;
Do you think those comments should be changed to "above which" ?
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Yes, those comments are wrong. I'll fix it now.
You'll be able to get the old behaviour for your charts by adding:
when you create your ChartPanel. Sorry for the inconvenience (lots of people have been asking why the fonts get distorted for large panels, which is why I made the defaults a little higher).
You'll be able to get the old behaviour for your charts by adding:
Code: Select all
panel.setMaximumDrawWidth(800);
panel.setMaximumDrawHeight(600);
when you create your ChartPanel. Sorry for the inconvenience (lots of people have been asking why the fonts get distorted for large panels, which is why I made the defaults a little higher).
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

