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
How to change the axis value font on a JFreeChart
提问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
Try setTickLabelFont(java.awt.Font font)
on the relevant 'Axis'.