日期:2014-05-16 浏览次数:20955 次
private void setChartFont(JFreeChart jfreechart) {
Font font = new Font("宋体", Font.BOLD, 25);
jfreechart.getTitle().setFont(font);
font = new Font("宋体", Font.PLAIN, 12);
LegendTitle legendTitle = jfreechart.getLegend();
if (null != legendTitle) {
legendTitle.setItemFont(font); // 图例文字字体
}
CategoryPlot categoryplot = jfreechart.getCategoryPlot();
CategoryAxis categoryaxis = categoryplot.getDomainAxis();
font = new Font("宋体", Font.PLAIN, 16);
categoryaxis.setLabelFont(font); // x轴名称的字体
categoryplot.getRangeAxis().setLabelFont(font); // y轴名称的字体
font = new Font("宋体", Font.PLAIN, 10);
categoryaxis.setTickLabelFont(font); // x轴上的刻度名称字体
categoryplot.getRangeAxis().setTickLabelFont(font); // y轴上的刻度名称字体
font = new Font("宋体", Font.PLAIN, 18);
categoryplot.setNoDataMessage("No Data");
categoryplot.setNoDataMessageFont(font);
}