现在的位置: 首页 > 综合 > 正文

在jfreechart 添加文字

2014年11月23日 ⁄ 综合 ⁄ 共 529字 ⁄ 字号 评论关闭

PiePlot3D plot = (PiePlot3D) chart.getPlot();

1.添加子标题

chart.addSubtitle(new TextTitle(  "sub title"));

2.添加定制文字

         String DATE_FORMAT_LONG="yyyy-MM-dd HH:mm:ss";
         SimpleDateFormat sdf=new SimpleDateFormat(DATE_FORMAT_LONG);
         TextTitle source = new TextTitle(    sdf.format( new Date() ) );
         source.setFont(new Font( "SansSerif", Font.PLAIN,   10));
         source.setPosition( RectangleEdge.BOTTOM );
         source.setHorizontalAlignment( HorizontalAlignment.RIGHT );
         chart.addSubtitle(source);
         chart.setBackgroundPaint(Color.white);

抱歉!评论已关闭.