gpt4 book ai didi

java - 更改 jfreechart 的域轴标签和范围轴标签的字体大小

转载 作者:搜寻专家 更新时间:2023-10-30 21:00:40 24 4
gpt4 key购买 nike

我的目标是增加“Revenue ($)”和“Years”的大小。但是我不知道怎么做。我能够增加“苹果、榴莲、橙子”和“2012、2013”​​。

下面是我的代码。

image

    JFreeChart chart = ChartFactory.createBarChart3D("", // chart title
"Years", // domain axis label
"Revenue ($)", // range axis label
dataset, // data
PlotOrientation.VERTICAL, // orientation
false, // include legend
false, // tooltips
false);

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

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

Font font = new Font("Dialog", Font.PLAIN, 25);
axis.setTickLabelFont(font);
Font font2 = new Font("Dialog", Font.PLAIN, 15);
axis2.setTickLabelFont(font2);

LegendTitle legend = new LegendTitle(plot.getRenderer());

Font font3 = new Font("Dialog", Font.PLAIN, 20);
legend.setItemFont(font3);
legend.setPosition(RectangleEdge.BOTTOM);
chart.addLegend(legend);

最佳答案

使用

CategoryPlot plot = chart.getCategoryPlot();
Font font3 = new Font("Dialog", Font.PLAIN, 25);
plot.getDomainAxis().setLabelFont(font3);
plot.getRangeAxis().setLabelFont(font3);

关于java - 更改 jfreechart 的域轴标签和范围轴标签的字体大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21401573/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com