JFreeChart如何修改字体 200
theme.setExtraLargeFont(newFont("Dialog",Font.PLAIN,7));theme.setLargeFont(newFont("D...
theme.setExtraLargeFont(new Font("Dialog", Font.PLAIN, 7)); theme.setLargeFont(new Font("Dialog", Font.PLAIN, 7)); theme.setRegularFont(new Font("宋体", Font.PLAIN, 6)); theme.setSmallFont(new Font("宋体", Font.PLAIN, 5)); return theme;
字体大小能改变,就是字体怎么改也没用。。 展开
字体大小能改变,就是字体怎么改也没用。。 展开
1个回答
展开全部
jfreechart设置字体
有中文的背景下,如果不设置字体,将会乱码。
分为柱状,饼状,曲线图。
分别为:
柱状:
[java] view plaincopy
TextTitle textTitle = chart.getTitle();
textTitle.setFont(new Font("黑体",Font.BOLD,15));
CategoryPlot plot=chart.getCategoryPlot();
CategoryAxis domainAxis=plot.getDomainAxis();
domainAxis.setLabelFont(new Font("黑体",Font.BOLD,15));
domainAxis.setTickLabelFont(new Font("黑体",Font.BOLD,15));
ValueAxis valueAxis=plot.getRangeAxis();
valueAxis.setLabelFont(new Font("黑体",Font.BOLD,15));
饼状:
[java] view plaincopy
TextTitle textTitle = chart.getTitle();
textTitle.setFont(new Font("黑体",Font.BOLD,15));
PiePlot pieplot = (PiePlot) chart.getPlot();
pieplot.setLabelFont(new Font("宋体", 0, 12));
//没有数据的时候显示的内容
pieplot.setNoDataMessage("无数据显示");
pieplot.setCircular(false);
pieplot.setLabelGap(0.02D);
chart.getLegend().setItemFont(new Font("黑体",Font.BOLD,15));
曲线:
[java] view plaincopy
//设置子标题
TextTitle subtitle = new TextTitle("2007年度", new Font("黑体",
Font.BOLD, 12));
chart.addSubtitle(subtitle);
//设置主标题
chart.setTitle(new TextTitle("阿蜜果blog访问量统计", new Font("隶书",
Font.ITALIC, 15)));
chart.setAntiAlias(true);
XYPlot xyPlot=chart.getXYPlot();
ValueAxis valueAxis=xyPlot.getDomainAxis();
valueAxis.setLabelFont( new Font("黑体",
Font.BOLD, 12));
valueAxis.setTickLabelFont( new Font("黑体",
Font.BOLD, 12));
NumberAxis numberAxis = (NumberAxis) xyPlot.getRangeAxis();
// 设置y轴上的字体
numberAxis.setTickLabelFont(new Font("宋体", Font.PLAIN, 13));
// 设置y轴上的标题字体
numberAxis.setLabelFont(new Font("宋体", Font.PLAIN, 13));
chart.getLegend().setItemFont(new Font("宋体", Font.PLAIN, 13));
有中文的背景下,如果不设置字体,将会乱码。
分为柱状,饼状,曲线图。
分别为:
柱状:
[java] view plaincopy
TextTitle textTitle = chart.getTitle();
textTitle.setFont(new Font("黑体",Font.BOLD,15));
CategoryPlot plot=chart.getCategoryPlot();
CategoryAxis domainAxis=plot.getDomainAxis();
domainAxis.setLabelFont(new Font("黑体",Font.BOLD,15));
domainAxis.setTickLabelFont(new Font("黑体",Font.BOLD,15));
ValueAxis valueAxis=plot.getRangeAxis();
valueAxis.setLabelFont(new Font("黑体",Font.BOLD,15));
饼状:
[java] view plaincopy
TextTitle textTitle = chart.getTitle();
textTitle.setFont(new Font("黑体",Font.BOLD,15));
PiePlot pieplot = (PiePlot) chart.getPlot();
pieplot.setLabelFont(new Font("宋体", 0, 12));
//没有数据的时候显示的内容
pieplot.setNoDataMessage("无数据显示");
pieplot.setCircular(false);
pieplot.setLabelGap(0.02D);
chart.getLegend().setItemFont(new Font("黑体",Font.BOLD,15));
曲线:
[java] view plaincopy
//设置子标题
TextTitle subtitle = new TextTitle("2007年度", new Font("黑体",
Font.BOLD, 12));
chart.addSubtitle(subtitle);
//设置主标题
chart.setTitle(new TextTitle("阿蜜果blog访问量统计", new Font("隶书",
Font.ITALIC, 15)));
chart.setAntiAlias(true);
XYPlot xyPlot=chart.getXYPlot();
ValueAxis valueAxis=xyPlot.getDomainAxis();
valueAxis.setLabelFont( new Font("黑体",
Font.BOLD, 12));
valueAxis.setTickLabelFont( new Font("黑体",
Font.BOLD, 12));
NumberAxis numberAxis = (NumberAxis) xyPlot.getRangeAxis();
// 设置y轴上的字体
numberAxis.setTickLabelFont(new Font("宋体", Font.PLAIN, 13));
// 设置y轴上的标题字体
numberAxis.setLabelFont(new Font("宋体", Font.PLAIN, 13));
chart.getLegend().setItemFont(new Font("宋体", Font.PLAIN, 13));
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询