在本人博客中将会列出柱状图、饼图、动态曲线图、静态曲线图、折线图,所有的代码都是参照于网上,在加上一些个人的注释,希望能过对大家有所帮助。
所有图片都是利用JFreeChart来生成,所以我们首先需要下载JFreeChart包(建议大家使用JFreeChart-1.0.9,我在使用JFreeChart-1.0.11版本的时候,一直出现IO异常)
下载地址:http://download.csdn.net/source/337198
此篇为柱状图:
- import java.awt.Font;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import org.jfree.chart.ChartFactory;
- import org.jfree.chart.ChartUtilities;
- import org.jfree.chart.JFreeChart;
- import org.jfree.chart.axis.CategoryAxis;
- import org.jfree.chart.axis.CategoryLabelPositions;
- import org.jfree.chart.axis.NumberAxis;
- import org.jfree.chart.plot.CategoryPlot;
- import org.jfree.chart.plot.PlotOrientation;
- import org.jfree.chart.title.TextTitle;