关于Jfreechart中的中文显示问题

最近项目中用到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); <淘宝热门商品:
 

3.50 元  

联达电子音响材料网淘宝分铺

【联达电子】镀银优质九脚电子管管座

 

138.00 元  

免邮-七色瘦减肥胶囊-店主亲试劲减30斤前后照片


来源:程序员网

小小豆叮

0 Responses to "关于Jfreechart中的中文显示问题"

发表评论