关于Jfreechart中的中文显示问题

本文介绍如何在使用JFreeChart 0.9.8版本绘制统计图表时,通过设置字体来改善中文显示效果,避免文字模糊的问题。文章提供了具体的代码示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> 最近项目中用到jfreechart,使用的版本是:jfreechart-0.9.8。 如果不进行相关的font的设置,生成的统计图表显示的中文非常模糊。 做了一个例子,可以成功的解决这个问题,拿来与大家共享。 核心代码如下: JFreeChart chart = ChartFactory.createVerticalBarChart3D(title, domain, range, dataset,true,true,false); chart.setBackgroundPaint(new GradientPaint(0.0F, 0.0F, Color.white, 1000F, 0.0F, Color.red)); chart.setTitle(new TextTitle(title, new Font("隶书", Font.ITALIC, 15))); Font font=new Font("黑体",Font.TRUETYPE_FONT, 12); StandardLegend legend = (StandardLegend) chart.getLegend(); legend.setItemFont(font); CategoryPlot plot = (CategoryPlot)chart.getPlot(); plot.setForegroundAlpha(0.9F); CategoryAxis domain_axis = plot.getDomainAxis(); domain_axis.setTickLabelFont(font); ValueAxis value_axis=plot.getRangeAxis(); value_axis.setTickLabelFont(font);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值