JfreeChart如何处理乱码
今天在JE问答上答题,一个关于JfreeChart如何处理乱码问题。我之前一直是将中文,繁体或者简体转成unicode码的。后来发现将jfreeChart的ChartTheme设置成unicode也是可以的。记录一下。
?
StandardChartTheme theme = new StandardChartTheme("unicode") {?
public void apply(JFreeChart chart) {?
chart.getRenderingHints().put(RenderingHints.KEY_TEXT_ANTIALIASING,?
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);?
super.apply(chart);?
}?
};?
theme.setExtraLargeFont(new Font("宋体", Font.PLAIN, 20));?
theme.setLargeFont(new Font("宋体", Font.PLAIN, 14));?
theme.setRegularFont(new Font("宋体", Font.PLAIN, 12));?
theme.setSmallFont(new Font("宋体", Font.PLAIN, 10));?
ChartFactory.setChartTheme(theme);