java 如何更改 JFreeChart 上的轴值字体

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7273642/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 19:22:54  来源:igfitidea点击:

How to change the axis value font on a JFreeChart

javajfreechartfont-size

提问by chris

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.

正如标题所说,如果我有一个JFreeChart(或想创建一个),我该如何指定用于轴上值的字体?不是轴标签,而是实际值。具体来说,我只是想让字体大一点。

回答by Neo

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)

回答by toto2