Help with font size please

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Post Reply
dgarratt
Posts: 8
Joined: Mon Aug 19, 2019 7:29 pm
antibot: No, of course not.

Help with font size please

Post by dgarratt » Mon Sep 30, 2019 3:40 pm

I would like to be able to reduce the font shown in the green box in the image url below. Although this example does not present a problem I will be looking a recording a lot more entries and I would like to be able to display as many points as possible.

Image
https://pasteboard.co/IzOBuKp.jpg

I am using JFreeChart 1.5 files but I've not found an example of how to adjust the font size.

The only text I found online was https://stackoverflow.com/questions/214 ... jfreechart

but I've not had any luck applying it to my code which is based on the demo source DualAxisDemo2.java

Many thanks in advance.

Dave

david.gilbert
JFreeChart Project Leader
Posts: 11703
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Help with font size please

Post by david.gilbert » Tue Oct 01, 2019 4:19 am

You can use the setTickLabelFont() method:

Code: Select all

plot.getDomainAxis().setTickLabelFont(new Font(Font.DIALOG, Font.BOLD, 6));
Just note in the demo that the line

Code: Select all

ChartUtils.applyCurrentTheme(chart);
will override any formatting changes you make, so you should either adjust the theme, or make your changes after the theme has been applied.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited

dgarratt
Posts: 8
Joined: Mon Aug 19, 2019 7:29 pm
antibot: No, of course not.

Re: Help with font size please

Post by dgarratt » Tue Oct 01, 2019 4:43 pm

Thank you for this - I will give it a try,

Post Reply