Fonts seem smaller than they should in charts

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
eladmena
Posts: 9
Joined: Tue Sep 08, 2009 12:19 pm
antibot: No, of course not.

Fonts seem smaller than they should in charts

Post by eladmena » Mon Oct 26, 2009 5:28 pm

Hey.
I'm having a problem with font sizes in the title or axes.
setting a font for the title or axes makes the font look smaller by about 1.5 than the specified size.
As a workaround I have set the font getter to return a font with the original size multiplied by 1.5, but that's not the ideal solution
setting a larger chart area doesn't affect the size of the font.

Is this a known issue?

Thanks
Elad

Code: Select all

chart.getTitle().setFont(<someFont>)

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: Fonts seem smaller than they should in charts

Post by paradoxoff » Mon Oct 26, 2009 10:26 pm

If the size of the ChartPanel exceeds the dimension defined by maximumDrawWidth and maximumDrawHeight, it will still render the chart in a Rectangle with maximumDrawWidth and maximumDrawHeight but then scale the chart to fill the entire size.
Does it look better if you call chartPanel.setMaximumDrawHeight(10000) and chartPanel.setMaximumDrawHeight(10000)?

eladmena
Posts: 9
Joined: Tue Sep 08, 2009 12:19 pm
antibot: No, of course not.

Re: Fonts seem smaller than they should in charts

Post by eladmena » Thu Oct 29, 2009 2:24 pm

I'm not using ChartPanel.
I only use it to create images using: chart.createBufferedImage(<Width>, <Height>);

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: Fonts seem smaller than they should in charts

Post by paradoxoff » Thu Oct 29, 2009 10:00 pm

JFreeChart uses ordinary Java2D calls to draw strings. Do the fonts of JButton and JLabels look equally wrong?

eladmena
Posts: 9
Joined: Tue Sep 08, 2009 12:19 pm
antibot: No, of course not.

Re: Fonts seem smaller than they should in charts

Post by eladmena » Sun Jan 03, 2010 2:08 pm

Sorry for the late reply, I wasn't at work for a while.
Testing JLabel produced the same size of fonts as the generated charts.

Thanks

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: Fonts seem smaller than they should in charts

Post by paradoxoff » Mon Jan 04, 2010 4:17 pm

If JLabels and JButtons are not displayed as expected as well, then either your expectations are too high or your JVM has a bug.
What is your OS and JDK version ?

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Re: Fonts seem smaller than they should in charts

Post by skunk » Thu Jan 07, 2010 6:05 pm

Perhaps the browser you are using to display the generated images is scaling the image?

Locked