웹 개발

JFreeChart 한글처리

노루아부지 2019. 7. 31. 17:31
//chart 한글 처리
//title
chart.getTitle().setFont(new Font("HYGSRB", Font.BOLD, 20));
//범례
chart.getLegend().setItemFont(new Font("HYGSRB", Font.BOLD, 10));
  
CategoryPlot plot = (CategoryPlot)chart.getPlot();
Font labelFont = null;
  
//x축 제목 한글처리
labelFont = plot.getDomainAxis().getLabelFont();
plot.getDomainAxis().setLabelFont(new Font("HYGSRB", labelFont.getStyle(), labelFont.getSize()));

//y축 제목 한글처리
labelFont = plot.getRangeAxis().getLabelFont();
plot.getRangeAxis().setLabelFont(new Font("HYGSRB", labelFont.getStyle(), labelFont.getSize()));
  
//x축 값 한글처리
//labelFont = plot.getDomainAxis().getTickLabelFont();
//plot.getDomainAxis().setTickLabelFont(new Font("HYGSRB", labelFont.getStyle(), labelFont.getSize()));
  
//y축 값 한글처리
//labelFont = plot.getRangeAxis().getTickLabelFont();
//plot.getRangeAxis().setTickLabelFont(new Font("HYGSRB", labelFont.getStyle(), labelFont.getSize()));
728x90
loading