How to change the axis value font on a JFreeChart
Asked Answered
C

2

6

Just as the title says, if I have a JFreeChart (or want to create one) how do I specify the font that is used for the values on the axis? Not the axis label, but the actual values. Specifically I just want to make the font a little bigger.

Cruz answered 1/9, 2011 at 16:50 Comment(0)
V
10

Try setTickLabelFont(java.awt.Font font) on the relevant 'Axis'.

Vocabulary answered 1/9, 2011 at 17:16 Comment(0)
S
15

For Range Axis

 CategoryPlot p = chart.getCategoryPlot(); 
 ValueAxis axis = p.getRangeAxis();

For Domian Axis

 CategoryPlot p = chart.getCategoryPlot(); 
 CategoryAxis axis = p.getDomainAxis();

then set the font like

Font font = new Font("Dialog", Font.PLAIN, 30);
axis.setTickLabelFont(font)
Sure answered 2/5, 2013 at 13:7 Comment(1)
setTicklabelFont -> setTickLabelFontTemperamental
V
10

Try setTickLabelFont(java.awt.Font font) on the relevant 'Axis'.

Vocabulary answered 1/9, 2011 at 17:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.