How to change font of axis value to JFreeChart

As the name says, if I have a JFreeChart (or want to create one), how can I specify the font that is used for the values ​​on the axis? Not the axis label, but the actual values. In particular, I just want to make the font a little bigger.

+6
source share
2 answers

Try setTickLabelFont(java.awt.Font font) in the corresponding "axis" .

+9
source

For range axis

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

For axis Domian

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

then set the font as

 Font font = new Font("Dialog", Font.PLAIN, 30); axis.setTickLabelFont(font) 
+12
source

Source: https://habr.com/ru/post/896428/


All Articles